Tests: trim the midpoint snap tests to what #2855 changes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Bar BorerandClaude Opus 5.5 committed 2026-11-03 05:07:59 +02:00
1 parent 39119ff9ce
commit 8a37ff6b43
2 files changed
+2 -17

No files matched your search

-6
View File
@@ -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
+2 -11
View File
@@ -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:?}");
}
}