Skip to content

Commit ffdac80

Browse files
committed
Add test for negative dash offset
Signed-off-by: sagudev <[email protected]>
1 parent 9140ea5 commit ffdac80

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed
572 Bytes
Loading

vello_tests/tests/known_issues.rs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use scenes::ImageCache;
1616
use vello::{
1717
AaConfig, Scene,
18-
kurbo::{Affine, Rect},
18+
kurbo::{Affine, Point, Rect, Size},
1919
peniko::{Extend, ImageFormat, ImageQuality, color::palette},
2020
};
2121
use vello_tests::{TestParams, smoke_snapshot_test_sync};
@@ -78,6 +78,26 @@ fn many_bins_cpu() {
7878
many_bins(true);
7979
}
8080

81+
/// Test for <https://github.com/linebender/vello/issues/1066>
82+
#[test]
83+
#[should_panic]
84+
fn test_negative_dash_offset() {
85+
let mut scene = Scene::new();
86+
let stroke = vello::kurbo::Stroke::new(1.0).with_dashes(-30., [4., 2.]);
87+
scene.stroke(
88+
&stroke,
89+
Affine::IDENTITY,
90+
vello::peniko::Color::from_rgb8(0, 255, 0),
91+
None,
92+
&Rect::from_origin_size(Point::new(1., 1.), Size::new(28., 28.)),
93+
);
94+
let mut params = TestParams::new("negative_dash_offset", 30, 30);
95+
params.anti_aliasing = AaConfig::Area;
96+
smoke_snapshot_test_sync(scene, &params)
97+
.unwrap()
98+
.assert_mean_less_than(0.001);
99+
}
100+
81101
const DATA_IMAGE_PNG: &[u8] = include_bytes!("../snapshots/smoke/data_image_roundtrip.png");
82102

83103
/// Test for <https://github.com/linebender/vello/issues/972>

0 commit comments

Comments
 (0)