From e2580ccdb5eff373e85eac65104f00e534f75eba Mon Sep 17 00:00:00 2001 From: tjbbjt <102318757+tjbbjt@users.noreply.github.com> Date: Mon, 9 Nov 2026 22:26:46 -0800 Subject: [PATCH] Tests: document the Color Sampler tests updated for pixel centres --- crates/engine/src/cmd/artboard_cmds/tests.rs | 4 ++++ crates/ui-egui/src/tools/analysis_ui/sampler_menu_tests.rs | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/crates/engine/src/cmd/artboard_cmds/tests.rs b/crates/engine/src/cmd/artboard_cmds/tests.rs index 679cd6e7b7..1cfe00cc73 100644 --- a/crates/engine/src/cmd/artboard_cmds/tests.rs +++ b/crates/engine/src/cmd/artboard_cmds/tests.rs @@ -723,6 +723,8 @@ fn moving_an_artboard_left_of_or_above_the_origin_grows_the_canvas_there() { } } +/// Moving or making a board past the canvas origin re-bases the document; the Color Sampler +/// points and the painting symmetry shift with it and stay on the same pixels. #[test] fn a_board_past_the_origin_moves_the_color_samplers_and_symmetry_with_the_document() { // #9302: the re-based document moved everything but the Color Sampler points and the @@ -778,6 +780,8 @@ fn a_board_past_the_origin_moves_the_color_samplers_and_symmetry_with_the_docume assert_eq!(samplers(&s), vec![[f64::from(by) + 5.5, 5.5]]); } +/// Duplicating a board whose document has boards past the origin (one or several selected +/// layers) re-bases it; the Color Sampler points shift with the document. #[test] fn duplicating_a_board_beside_one_past_the_origin_moves_the_color_samplers_with_the_document() { // #9302 review: Layer › Duplicate puts the copy right of its board, but `fit_canvas` still diff --git a/crates/ui-egui/src/tools/analysis_ui/sampler_menu_tests.rs b/crates/ui-egui/src/tools/analysis_ui/sampler_menu_tests.rs index 7edad88dbd..e950d770f3 100644 --- a/crates/ui-egui/src/tools/analysis_ui/sampler_menu_tests.rs +++ b/crates/ui-egui/src/tools/analysis_ui/sampler_menu_tests.rs @@ -98,6 +98,8 @@ fn right_click_off_a_sampler_greys_every_row() { assert_eq!(samplers(&app).len(), 2, "nothing deleted, no sampler placed"); } +/// The right-click menu's Delete removes the sampler under the pointer, closes the menu, and +/// the samplers after it move up a number. #[test] fn delete_removes_the_sampler_under_the_pointer_and_renumbers_the_rest() { let (mut app, ctx) = app(); @@ -112,6 +114,8 @@ fn delete_removes_the_sampler_under_the_pointer_and_renumbers_the_rest() { assert_eq!(listed["samplers"][1]["number"], json!(2)); } +/// Delete never removes a different sampler when the list changes while the menu is open: one +/// deleted or moved meanwhile, or another document with a sampler at the same index and spot. #[test] fn delete_never_removes_another_sampler_after_the_list_changes_under_the_menu() { let (mut app, ctx) = app(); @@ -150,6 +154,8 @@ fn readout_rows_do_nothing_until_samplers_have_readout_modes() { assert_eq!(samplers(&app).len(), 2); } +/// A sampler gone while the menu is open, a non-finite point, or no document at all: Delete +/// greys out and nothing panics. #[test] fn a_stale_sampler_or_odd_point_fails_gracefully() { let (mut app, ctx) = app();