diff --git a/crates/engine/src/cmd/actions_edit_cmds.rs b/crates/engine/src/cmd/actions_edit_cmds.rs index f3b55795c19..c62400246a2 100644 --- a/crates/engine/src/cmd/actions_edit_cmds.rs +++ b/crates/engine/src/cmd/actions_edit_cmds.rs @@ -699,7 +699,7 @@ mod tests { fn record_conditional(width: u32, height: u32) -> (Session, usize) { let mut s = Session::new(); s.execute("file.new", json!({"width": width, "height": height})).unwrap(); - s.actions.list.push(Action::new("Tall", vec![("layer.new.layer".into(), json!({"name": "Tall"}))])); + s.actions.list.push(Action::new("Tall", vec![ActionStep::new("layer.new.layer", json!({"name": "Tall"}))])).unwrap(); let layers = s.active().unwrap().doc.walk().len(); s.execute("actions.record", json!({"name": "Parent"})).unwrap(); s.execute("actions.conditional", json!({"if": "portrait", "then": "Tall", "else": null})).unwrap(); @@ -707,14 +707,14 @@ mod tests { (s, layers) } - fn parent_steps(s: &Session) -> Vec<(String, Value)> { - s.actions.list.iter().find(|a| a.name == "Parent").unwrap().steps.clone() + fn parent_steps(s: &Session) -> Vec { + s.actions.list.actions().iter().find(|a| a.name == "Parent").unwrap().steps.clone() } #[test] fn recording_a_conditional_keeps_the_step_when_no_branch_runs() { let (mut s, layers) = record_conditional(8, 4); - let expected = vec![("actions.conditional".to_string(), json!({"if": "portrait", "then": "Tall", "else": null}))]; + let expected = vec![ActionStep::new("actions.conditional", json!({"if": "portrait", "then": "Tall", "else": null}))]; assert_eq!(parent_steps(&s), expected); assert_eq!(s.active().unwrap().doc.walk().len(), layers, "the false predicate runs no branch"); s.execute("file.new", json!({"width": 4, "height": 8})).unwrap(); @@ -729,7 +729,7 @@ mod tests { #[test] fn recording_a_conditional_keeps_the_predicate_when_a_branch_runs() { let (s, layers) = record_conditional(4, 8); - let expected = vec![("actions.conditional".to_string(), json!({"if": "portrait", "then": "Tall", "else": null}))]; + let expected = vec![ActionStep::new("actions.conditional", json!({"if": "portrait", "then": "Tall", "else": null}))]; assert_eq!(parent_steps(&s), expected, "no nested actions.play is recorded"); assert_eq!(s.active().unwrap().doc.walk().len(), layers + 1, "the true predicate runs Tall"); } diff --git a/crates/engine/src/cmd/edit_cmds/tests.rs b/crates/engine/src/cmd/edit_cmds/tests.rs index 49c7712d90d..f361840d32d 100644 --- a/crates/engine/src/cmd/edit_cmds/tests.rs +++ b/crates/engine/src/cmd/edit_cmds/tests.rs @@ -1926,9 +1926,10 @@ fn paste_onto_a_smaller_artboard_keeps_the_offset_and_the_board_clips_the_rest() assert!(!(px(315, 35)[0] > 0.99 && px(315, 35)[1] < 0.01), "clipped past S's edge"); } -/// A pasted layer that joins a board keeps its own clipping while the board already holds a layer -/// it can clip to, and drops it on an empty board (#10538 review): a clipped group copied whole -/// from board A and pasted onto smaller boards S (holding a layer) and E (empty). +/// A clipped group copied without its base is released, including when it joins a board that +/// already holds a layer (#9736, #9833): Copy drops the clip so the paste does not attach to +/// whatever it lands on. #10538 used to keep the clip when the destination board already had a +/// layer; that no longer applies once the base is left behind. #[test] fn a_clipped_paste_joining_a_board_stays_clipped_only_over_a_layer() { let (mut s, red, a, _b) = two_boards(); @@ -1958,7 +1959,7 @@ fn a_clipped_paste_joining_a_board_stays_clipped_only_over_a_layer() { let id = st.active_layer.unwrap(); (st.doc.artboard_of(id), st.doc.layer(id).unwrap().clipped) }; - assert_eq!(paste_on(&mut s, sb), (Some(sb), true), "S holds a layer to clip to"); + assert_eq!(paste_on(&mut s, sb), (Some(sb), false), "released even though S holds a layer"); assert_eq!(paste_on(&mut s, eb), (Some(eb), false), "E is empty"); }