diff --git a/vello_tests/snapshots/smoke/negative_dash_offset.png b/vello_tests/snapshots/smoke/negative_dash_offset.png new file mode 100644 index 000000000..a47eab13e Binary files /dev/null and b/vello_tests/snapshots/smoke/negative_dash_offset.png differ diff --git a/vello_tests/tests/regression.rs b/vello_tests/tests/regression.rs index cd34c7596..865daa92f 100644 --- a/vello_tests/tests/regression.rs +++ b/vello_tests/tests/regression.rs @@ -7,7 +7,7 @@ use scenes::ImageCache; use scenes::SimpleText; use vello::{ AaConfig, Scene, - kurbo::{Affine, Rect, RoundedRect, Stroke}, + kurbo::{Affine, Point, Rect, RoundedRect, Size, Stroke}, peniko::{Extend, ImageQuality, color::palette}, }; use vello_tests::{TestParams, smoke_snapshot_test_sync, snapshot_test_sync}; @@ -89,3 +89,26 @@ fn text_stroke_width_zero() { .unwrap() .assert_mean_less_than(0.001); } + +/// Test for +#[test] +fn test_negative_dash_offset() { + let mut scene = Scene::new(); + let stroke = Stroke::new(1.0).with_dashes(-30., [4., 2.]); + scene.stroke( + &stroke, + Affine::IDENTITY, + palette::css::BLUE, + None, + &Rect::from_origin_size(Point::new(1., 1.), Size::new(28., 28.)), + ); + let mut params = TestParams::new("negative_dash_offset", 30, 30); + params.anti_aliasing = AaConfig::Area; + smoke_snapshot_test_sync(scene, ¶ms) + .unwrap() + .assert_mean_less_than(if cfg!(target_os = "macos") { + 0.005 + } else { + 0.001 + }); +}