mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-02 06:20:48 +01:00
Mixer Brush switches: a toggle by key moves the brush revision so it is saved (CodeRabbit review on crates/engine/src/cmd/brush_cmds.rs:825)
Without it, a switch flipped by its shortcut and nothing else before quitting was not written to the last-brush preferences. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
7299d49e68
commit
87870c6802
2 files changed
+16
-1
No files matched your search
@@ -822,7 +822,10 @@ fn mixer_toggle(s: &mut Session, p: &Value, cmd: &str) -> Result<Value> {
|
||||
};
|
||||
let value = field(&mut s.tools.brush.mixer);
|
||||
*value = on.unwrap_or(!*value);
|
||||
Ok(json!({ "on": *value }))
|
||||
let on = *value;
|
||||
// Saved like any other brush change (the last-brush persistence watches the revision).
|
||||
s.tools.brush_changed();
|
||||
Ok(json!({ "on": on }))
|
||||
}
|
||||
|
||||
/// `paint.mixerLoad`: ⌥-click with the Mixer Brush loads the reservoir from the canvas colour at
|
||||
|
||||
@@ -67,3 +67,15 @@ fn keyboard_shortcuts_list_the_five_without_keys_and_can_assign_one() {
|
||||
assert_eq!(row(id)["label"], label);
|
||||
}
|
||||
}
|
||||
|
||||
/// A switch flipped by its key is saved like any other brush change: it moves the brush revision
|
||||
/// the last-brush persistence watches (CodeRabbit review on brush_cmds.rs:825).
|
||||
#[test]
|
||||
fn each_switch_marks_the_brush_changed_so_it_is_saved() {
|
||||
let mut s = Session::new();
|
||||
for (id, _) in SWITCHES {
|
||||
let rev = s.tools.brush_rev;
|
||||
s.execute(id, json!({})).unwrap();
|
||||
assert_ne!(s.tools.brush_rev, rev, "{id} moves the brush revision");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user