From 5d494db4d99dd45ab9657fc9a5a1168c2cd8173f Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 1 Dec 2026 14:16:38 -0800 Subject: [PATCH] Tests: Connect tangents' external shape does not cross itself The test checked only which corners the shape has, so corners joined in the wrong order passed. It now also checks the shape's area. --- crates/engine/src/cmd/addons/pathtools/tangents/tests.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/engine/src/cmd/addons/pathtools/tangents/tests.rs b/crates/engine/src/cmd/addons/pathtools/tangents/tests.rs index 032ef5f377..1653089520 100644 --- a/crates/engine/src/cmd/addons/pathtools/tangents/tests.rs +++ b/crates/engine/src/cmd/addons/pathtools/tangents/tests.rs @@ -385,6 +385,9 @@ fn connect_joins_the_external_tangents_and_the_chords_into_one_closed_shape_in_o for p in [Point::new(100.0, 80.0), Point::new(200.0, 80.0), Point::new(200.0, 120.0), Point::new(100.0, 120.0)] { assert!(found.iter().any(|&q| near(p, q)), "{p:?} in {found:?}"); } + // In order around the band, not crossing itself: the area is the 100 by 40 rectangle's. + let area = found.iter().zip(found.iter().cycle().skip(1)).map(|(p, q)| p.x * q.y - q.x * p.y).sum::() / 2.0; + assert!((area.abs() - 4000.0).abs() < 1e-6, "area {area} of {found:?}"); s.execute("edit.undo", &json!({})).unwrap(); assert_eq!(s.doc().unwrap().doc.node_count(), count); }