From 8a37ff6b43b65a48d20005b7f9bf6019dd159bc1 Mon Sep 17 00:00:00 2001 From: Bar Borer Date: Tue, 3 Nov 2026 05:07:59 +0200 Subject: [PATCH] Tests: trim the midpoint snap tests to what #2855 changes Co-Authored-By: Claude Opus 5.5 --- crates/engine/src/tests/viewer.rs | 6 ------ crates/ui-egui/tests/it/ui_viewer.rs | 13 ++----------- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/crates/engine/src/tests/viewer.rs b/crates/engine/src/tests/viewer.rs index fa958a60c..9a0b9cc58 100644 --- a/crates/engine/src/tests/viewer.rs +++ b/crates/engine/src/tests/viewer.rs @@ -82,12 +82,6 @@ fn snap_point_beats_one_line_and_loses_only_to_two_nearer_lines() { let s = snap(&[[103.0, 51.0]], &[v, h, far], 5.0).unwrap(); assert_eq!(s.at, [102.0, 52.0]); assert_eq!(s.hits, [v, h]); - // A line out of its span doesn't count, so the point still wins. - let cut = SnapTarget::vline(103.0, PRI_LAYER, src).within(Some([0.0, 10.0])); - assert_eq!(snap(&[[103.0, 51.0]], &[cut, top, mid], 5.0).unwrap().hits, [mid]); - // No point in reach: a single line still snaps its own axis. - let s = snap(&[[103.0, 51.0]], &[top], 5.0).unwrap(); - assert_eq!(s.at, [103.0, 50.0]); } /// #2855: an unrotated layer's centre lines follow its edges' span rule, reach the outer comp diff --git a/crates/ui-egui/tests/it/ui_viewer.rs b/crates/ui-egui/tests/it/ui_viewer.rs index 39c70eecd..617de83ce 100644 --- a/crates/ui-egui/tests/it/ui_viewer.rs +++ b/crates/ui-egui/tests/it/ui_viewer.rs @@ -421,10 +421,9 @@ fn layer_drag_snaps_to_other_layers_edges_ctrl_toggles_and_options_apply() { } /// #2855: a dragged layer's edge midpoints snap to another layer's on both axes, side by side and -/// stacked, with Snap Edges Extended on and off; its centre lines snap along the target's extent, -/// and beyond it only with the option on. +/// stacked, with Snap Edges Extended on and off. #[test] -fn layer_drag_snaps_to_other_layers_midpoints_and_centre_lines() { +fn layer_drag_snaps_to_other_layers_midpoints() { let mut h = harness(); let box_id = h.state().session.active_comp().unwrap().layers[0].id; // A 100×100 target at x 450–550, y 50–150, centre (500, 100). @@ -454,14 +453,6 @@ fn layer_drag_snaps_to_other_layers_midpoints_and_centre_lines() { // Stacked: the box's top midpoint onto the target's bottom midpoint (500, 150). let p = drop(&mut h, [100.0, 210.5], [502.0, 153.0]); assert!(near(p, 500.0, 190.0), "top to bottom midpoint, extended {extended}: {p:?}"); - // Along the target, far from its centre point: the box's centre takes x from its centre - // line and y stays free. - let p = drop(&mut h, [100.0, 250.0], [503.0, 125.0]); - assert!((p[0] - 500.0).abs() < 0.01 && (p[1] - 125.0).abs() < 1.0, "centre line along the target, extended {extended}: {p:?}"); - // Beyond the target: its centre line reaches only with the option on. - let p = drop(&mut h, [100.0, 250.0], [503.0, 300.0]); - let snapped = (p[0] - 500.0).abs() < 0.01; - assert_eq!(snapped, extended, "centre line beyond the target, extended {extended}: {p:?}"); } }