From b3f3146402d611ae364e4a8ccca6aacd6fbb94de Mon Sep 17 00:00:00 2001 From: David Mann Date: Sun, 25 Oct 2026 03:23:22 +0100 Subject: [PATCH] Artboards: cover Artboard from Layers / Group in the sampler test (#9302) Co-Authored-By: Claude Opus 5.5 --- crates/engine/src/artboard_cmds/tests.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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);