diff --git a/crates/engine/src/artboard_cmds/tests.rs b/crates/engine/src/artboard_cmds/tests.rs index 5c40a33529..2c259d80a7 100644 --- a/crates/engine/src/artboard_cmds/tests.rs +++ b/crates/engine/src/artboard_cmds/tests.rs @@ -639,6 +639,19 @@ fn a_board_past_the_origin_moves_the_color_samplers_and_symmetry_with_the_docume s.execute("layer.new.artboard", json!({"rect": [-200, 0, 100, 80]})).unwrap(); assert_eq!(samplers(&s), vec![[215.0, 15.0]]); assert!(red_at(&s, 215, 15)); + // A board made from layers (or a group) left of the canvas shifts by their overhang. + for cmd in ["layer.new.artboardFromLayers", "layer.new.artboardFromGroup"] { + let mut s = session(8); + add_square(&mut s, Rect::new(10, 10, 30, 30), [1.0, 0.0, 0.0, 1.0]); + s.execute("view.colorSamplers.add", json!({"x": 15, "y": 15})).unwrap(); + add_square(&mut s, Rect::new(-30, 40, -10, 60), [0.0, 0.0, 1.0, 1.0]); + if cmd.ends_with("Group") { + s.execute("layer.groupLayers", json!({})).unwrap(); + } + s.execute(cmd, json!({})).unwrap(); + assert_eq!(samplers(&s), vec![[45.0, 15.0]], "{cmd}"); + assert!(red_at(&s, 45, 15), "{cmd}"); + } // The "+" button left of a board at the origin shifts by the board and the gap. let mut s = session(8); let gid = board_with_square(&mut s);