Skip to content

PhotoCraft: An open-source, photo editor written by scratch in pure Rust

Check the action survives a refused save

Hamzaa22fd1a788b6
diff --git a/crates/engine/src/atn_cmds/tests.rs b/crates/engine/src/atn_cmds/tests.rs
index 84578b842..f4da20001 100644
--- a/crates/engine/src/atn_cmds/tests.rs
+++ b/crates/engine/src/atn_cmds/tests.rs
@@ -212,10 +212,14 @@ fn a_setting_the_event_cannot_hold_is_refused() {
] {
let mut s = Session::new();
s.actions.list.push(Action::new("A", vec![(id.into(), params)]));
+ let before = s.actions.list[0].steps.clone();
let e = s.execute("actions.save", json!({"action": "A"})).unwrap_err().to_string();
assert!(e.contains(id), "{id}: {e}");
+ // A refused save leaves the action as it was: the step is still there to be played.
+ assert_eq!(s.actions.list[0].steps, before, "{id}");
let r = s.execute("actions.save", json!({"action": "A", "skipUnsupported": true})).unwrap();
assert_eq!(r["skipped"], json!([{"action": "A", "step": 0, "id": id}]), "{id}");
+ assert_eq!(s.actions.list[0].steps, before, "{id}: skipping a step does not drop it");
}
}