Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added vello_tests/snapshots/smoke/negative_dash_offset.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 24 additions & 1 deletion vello_tests/tests/regression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -89,3 +89,26 @@ fn text_stroke_width_zero() {
.unwrap()
.assert_mean_less_than(0.001);
}

/// Test for <https://github.com/linebender/vello/issues/1066>
#[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, &params)
.unwrap()
.assert_mean_less_than(if cfg!(target_os = "macos") {
0.005
} else {
0.001
});
Comment on lines +107 to +113
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know why there is a difference between macOS and other systems here? Is it because of FastMath, or is it because macOS is tested on the GPU in CI?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IDK, I do not own mac system to check this.

}
Loading