Skip to content

Commit 2cb8b26

Browse files
committed
Add negative dash offset test
Signed-off-by: sagudev <[email protected]>
1 parent daf9402 commit 2cb8b26

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed
141 Bytes
Loading

vello_tests/tests/regression.rs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use scenes::ImageCache;
77
use scenes::SimpleText;
88
use vello::{
99
AaConfig, Scene,
10-
kurbo::{Affine, Rect, RoundedRect, Stroke},
10+
kurbo::{Affine, Point, Rect, RoundedRect, Size, Stroke},
1111
peniko::{Extend, ImageQuality, color::palette},
1212
};
1313
use vello_tests::{TestParams, smoke_snapshot_test_sync, snapshot_test_sync};
@@ -89,3 +89,22 @@ fn text_stroke_width_zero() {
8989
.unwrap()
9090
.assert_mean_less_than(0.001);
9191
}
92+
93+
/// Test for <https://github.com/linebender/vello/issues/1066>
94+
#[test]
95+
fn test_negative_dash_offset() {
96+
let mut scene = Scene::new();
97+
let stroke = Stroke::new(1.0).with_dashes(-30., [4., 2.]);
98+
scene.stroke(
99+
&stroke,
100+
Affine::IDENTITY,
101+
palette::css::BLUE,
102+
None,
103+
&Rect::from_origin_size(Point::new(1., 1.), Size::new(28., 28.)),
104+
);
105+
let mut params = TestParams::new("negative_dash_offset", 30, 30);
106+
params.anti_aliasing = AaConfig::Area;
107+
smoke_snapshot_test_sync(scene, &params)
108+
.unwrap()
109+
.assert_mean_less_than(0.001);
110+
}

0 commit comments

Comments
 (0)