From 67f53390fe4d4d2b268491f80048facb7c8d9dd8 Mon Sep 17 00:00:00 2001 From: eliets2 <287273517+eliets2@users.noreply.github.com> Date: Thu, 29 Oct 2026 14:18:39 +0200 Subject: [PATCH] masks: adapt the long-segment test to endpoint-only hostile segments A hostile segment now lays only its end point, so five of them no longer fill the stroke budget. The test asserts the endpoint-only count directly and proves that a stroke which has spent its count takes no more through push_dabs_counted, which tracks the budget across buffers. --- crates/pipeline/src/masks/tests.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/pipeline/src/masks/tests.rs b/crates/pipeline/src/masks/tests.rs index 66e451a75..59f258726 100644 --- a/crates/pipeline/src/masks/tests.rs +++ b/crates/pipeline/src/masks/tests.rs @@ -148,7 +148,8 @@ fn a_long_segment_gets_dabs_at_most_the_spacing_apart() { } assert_eq!(committed.dabs, again); assert!(committed.dabs.windows(2).all(|w| w[0].dist(w[1]) <= dab_spacing(committed.r) + 1e-9)); - // many huge segments stop at the stroke budget instead of adding up without bound + // a huge segment lays only its end point, so many of them add one dab each instead of + // filling the stroke budget with intermediate dabs let mut big = Vec::new(); let mut at = Point::new(0.0, 0.0); for i in 0..5 { @@ -157,8 +158,9 @@ fn a_long_segment_gets_dabs_at_most_the_spacing_apart() { at = q; } } - assert!(big.len() <= MAX_STROKE_DABS, "{} dabs", big.len()); - assert!(!push_dabs(&mut big, Some(at), Point::new(5.0, 5.0), 1.0), "a full stroke takes no more"); + assert_eq!(big.len(), 5, "an extreme segment lays no intermediate dabs"); + let mut spent = MAX_STROKE_DABS; + assert!(!push_dabs_counted(&mut big, &mut spent, Some(at), Point::new(5.0, 5.0), 1.0), "a full stroke takes no more"); // a hostile segment places no in-between dabs let mut v = Vec::new(); assert!(!push_dabs(&mut v, Some(Point::new(f64::NAN, 0.0)), Point::new(1.0, 1.0), r));