From e8c47428741292340a41ca9394b31fd02536cedc Mon Sep 17 00:00:00 2001 From: MortenHusted Date: Thu, 22 Oct 2026 10:27:34 +0200 Subject: [PATCH] M6: the open-subpath fixture covers stroke-first paint order A third row in open_subpaths.svg: a filled and stroked path that is only 0.001 short stays one layer, and an open triangle with paint-order="stroke" puts its stroke layer under its fill layer. --- crates/svg/tests/corpus.rs | 5 ++++- crates/svg/tests/corpus/open_subpaths.svg | 14 ++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/crates/svg/tests/corpus.rs b/crates/svg/tests/corpus.rs index ac0c38dd..24803c40 100644 --- a/crates/svg/tests/corpus.rs +++ b/crates/svg/tests/corpus.rs @@ -257,8 +257,11 @@ fn fills_close_open_subpaths() { let (fill, stroke) = (layer(&d, f, "stroked fill"), layer(&d, f, "stroked")); assert_eq!((loops(fill), fill.fills.len(), fill.strokes.len()), (2, 1, 0)); assert_eq!((loops(stroke), stroke.fills.len(), stroke.strokes.len()), (0, 0, 1)); + // Only near-closed ends: one layer, closed, stroke and all. + let near = layer(&d, f, "near"); + assert_eq!((loops(near), near.fills.len(), near.strokes.len()), (1, 1, 1)); let order: Vec<&str> = d.node(f).unwrap().children.iter().filter_map(|c| d.node(*c)).map(|n| n.name.as_str()).collect(); - assert_eq!(order, ["filled", "stroked fill", "stroked"], "the fill paints first, as SVG paints fill then stroke"); + assert_eq!(order, ["filled", "stroked fill", "stroked", "near", "under", "under fill"], "paint order: fill then stroke, or the stroke first"); } #[test] diff --git a/crates/svg/tests/corpus/open_subpaths.svg b/crates/svg/tests/corpus/open_subpaths.svg index 2d944942..daed50b7 100644 --- a/crates/svg/tests/corpus/open_subpaths.svg +++ b/crates/svg/tests/corpus/open_subpaths.svg @@ -1,10 +1,14 @@ - + + stroked: 0.001 short (closed, stroke and all); an open triangle (stroked open). Third row, + filled and stroked: only 0.001 short (one layer); an open triangle with its stroke under + the fill. --> + + @@ -15,4 +19,10 @@ + + + + + +