From 5277ec20ef30bc92e09e6b9a8ca1eb25d13e991f Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Thu, 3 Dec 2026 11:37:22 -0800 Subject: [PATCH] Tests: canvas painted points read the anchor marks as shapes The canvas tests that look for a mark at a point read circles, rectangles and lines from the frame. The selection's anchor marks now paint as one mesh, so painted_points has AnchorMarks paint the shapes the mesh is made of for its frame. --- crates/ui-egui/src/canvas/selection.rs | 2 +- crates/ui-egui/src/canvas/selection/tests.rs | 2 +- crates/ui-egui/src/canvas/tests.rs | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/ui-egui/src/canvas/selection.rs b/crates/ui-egui/src/canvas/selection.rs index e201066396..c2d53fcf97 100644 --- a/crates/ui-egui/src/canvas/selection.rs +++ b/crates/ui-egui/src/canvas/selection.rs @@ -1237,4 +1237,4 @@ fn view_key(app: &VectorcraftApp, st: &DocState, tool: &str, tool_points: bool) } #[cfg(test)] -mod tests; +pub(super) mod tests; diff --git a/crates/ui-egui/src/canvas/selection/tests.rs b/crates/ui-egui/src/canvas/selection/tests.rs index 850dd453a5..42adf76890 100644 --- a/crates/ui-egui/src/canvas/selection/tests.rs +++ b/crates/ui-egui/src/canvas/selection/tests.rs @@ -946,7 +946,7 @@ thread_local! { /// Whether `show` draws the anchor marks with `BezierOverlay`, as it did before [`AnchorMarks`]. pub(super) static OVERLAY_MARKS: std::cell::Cell = const { std::cell::Cell::new(false) }; /// Whether [`AnchorMarks`] paints its shapes one by one instead of as a mesh. - pub(super) static RAW_MARKS: std::cell::Cell = const { std::cell::Cell::new(false) }; + pub(in crate::canvas) static RAW_MARKS: std::cell::Cell = const { std::cell::Cell::new(false) }; /// How many meshes [`AnchorMarks`] tessellated. pub(super) static MESHES_BUILT: std::cell::Cell = const { std::cell::Cell::new(0) }; } diff --git a/crates/ui-egui/src/canvas/tests.rs b/crates/ui-egui/src/canvas/tests.rs index df0d8fc387..e7fec25534 100644 --- a/crates/ui-egui/src/canvas/tests.rs +++ b/crates/ui-egui/src/canvas/tests.rs @@ -267,10 +267,12 @@ fn the_shown_tool_follows_the_pointer_in_the_frame_it_moves() { } /// One headless canvas frame with `events` → the points it paints: the centres of circles and rectangles and the -/// points of lines and paths. +/// points of lines and paths. The selection's anchor marks paint as the shapes their mesh is made of. fn painted_points(app: &mut VectorcraftApp, ctx: &egui::Context, events: Vec) -> Vec { let raw = egui::RawInput { screen_rect: Some(egui::Rect::from_min_size(Pos2::ZERO, vec2(800.0, 600.0))), events, ..Default::default() }; + super::selection::tests::RAW_MARKS.with(|on| on.set(true)); let mut out = ctx.run_ui(raw, |ui| show(app, ui)); + super::selection::tests::RAW_MARKS.with(|on| on.set(false)); out.textures_delta.clear(); let mut points = vec![]; for shape in flat_shapes(out.shapes) {