From aefbe6793ba314e736e9bef3e25d423325b84c1a Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 28 Oct 2026 02:12:51 -0700 Subject: [PATCH] Tests: a Blob Brush stroke merges across a matching path it does not touch The merge test covered adjacent matches and a path of another color between two matches. It now also covers a matching path the stroke does not touch, between two it touches: both touched paths merge into the upper one and the untouched path is left as it was. --- crates/engine/src/tests/draw2.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/crates/engine/src/tests/draw2.rs b/crates/engine/src/tests/draw2.rs index c82b9ce82..f739f18b7 100644 --- a/crates/engine/src/tests/draw2.rs +++ b/crates/engine/src/tests/draw2.rs @@ -502,6 +502,19 @@ fn blob_brush_merges_with_the_topmost_match_and_its_neighbors() { assert_eq!(area(&path(&s, below)), area_below, "the path below the red one is left as it was"); assert_eq!(area(&path(&s, red)), area_red); + // A matching path the stroke does not touch, between two it touches: both touched ones merge, + // and the untouched one is left as it was. + let mut s = session(); + let lower = blob(&mut s, 100.0); + let untouched = NodeId(s.execute("path.blob", &json!({"points": [[200, 300], [200, 380]], "size": 20})).unwrap()["id"].as_u64().unwrap()); + let upper = blob(&mut s, 300.0); + let area_untouched = area(&path(&s, untouched)); + let id = NodeId(s.execute("path.blob", &across).unwrap()["id"].as_u64().unwrap()); + assert_eq!(id, upper); + assert!(s.doc().unwrap().doc.node(lower).is_none(), "the lower path joined the upper one"); + assert_eq!(area(&path(&s, untouched)), area_untouched); + assert_eq!(paths(&s).len(), 2); + // Two adjacent matches in a group both merge; a match outside the group is left alone. let mut s = session(); let outside = blob(&mut s, 100.0);