From ebb5365c24b372d0a2dab174c2cd9225c73a8f47 Mon Sep 17 00:00:00 2001 From: hnoerenberg Date: Wed, 25 Nov 2026 01:33:25 +0100 Subject: [PATCH] test(vector): require the first Pen anchor in the receiving document (#12890) `stale_pen_commits_to_its_owner_across_document_changes` compared each other document's anchor count with an upper bound, so the `pen` branch also passed when the press wrote nothing there: a document without a Work Path counts as zero anchors, and zero is within the bound. The branch names the #12890 behaviour, so it asks for it: the receiving document holds exactly the one anchor of the new press, and every other document still none. Test only - the branch passes at this head, it just stops accepting a missing first-click write. --- crates/ui-egui/src/tools/vector_ui/tests.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/crates/ui-egui/src/tools/vector_ui/tests.rs b/crates/ui-egui/src/tools/vector_ui/tests.rs index 5cf150ca7f..467a25139d 100644 --- a/crates/ui-egui/src/tools/vector_ui/tests.rs +++ b/crates/ui-egui/src/tools/vector_ui/tests.rs @@ -898,14 +898,14 @@ fn stale_pen_commits_to_its_owner_across_document_changes() { .map(|d| d.doc.work_path.as_ref().map_or(0, |p| p.subpaths.iter().map(|s| s.knots.len()).sum::())) .collect() }; - // #12890: a press in another document starts a Work Path there at once, so that document holds the one - // anchor the new draft has; nothing else goes there. - let allowed = usize::from(action == "pen"); - assert!( - others(&app).iter().all(|n| *n <= allowed), - "{tool:?} {action}: other documents hold no more than a new press's first anchor: {:?}", - others(&app) - ); + // #12890: a press in another document writes its Work Path there with its first anchor, so that document + // holds exactly that one anchor; every other document stays empty. + let counts = others(&app); + if action == "pen" { + assert_eq!(counts.as_slice(), &[1], "{tool:?} {action}: the receiving document has the press's one-anchor Work Path"); + } else { + assert!(counts.iter().all(|n| *n == 0), "{tool:?} {action}: no other document takes the draft: {counts:?}"); + } if action != "closeOther" { assert_ne!(app.session.active().unwrap().doc.id, owner, "the active document is restored"); }