mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-02 06:20:48 +01:00
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.
This commit is contained in:
1 parent
326a8bd78f
commit
ebb5365c24
1 file changed
+8
-8
@@ -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::<usize>()))
|
||||
.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");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user