From 66655c67c227c4d027ef1bd76f87dbf1228b0e89 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 21 Oct 2026 16:37:07 -0700 Subject: [PATCH] Tests: the Expand Appearance reply test fails when the reply leaves out the expanded object (#3374) the_reply_names_each_expanded_copy_by_its_own_id checked that no id in the effect.expandAppearance reply repeats and that each one names a node in the document. Only for group copies did it check which ids the reply holds. In the other four cases a reply that left out the expanded object, or held no ids at all, passed. The test now checks in every case that the reply starts with the id of the selected object, and keeps the exact check of the group and the two copies of the square for group copies. --- crates/engine/src/tests_expand.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/engine/src/tests_expand.rs b/crates/engine/src/tests_expand.rs index 9256494ae..3d7e0baea 100644 --- a/crates/engine/src/tests_expand.rs +++ b/crates/engine/src/tests_expand.rs @@ -159,9 +159,10 @@ fn expanded_art_keeps_the_random_transforms_the_canvas_drew() { assert_eq!(differ, RANDOM_CASES.map(|case| (case, 0))); } -/// The reply lists each object whose appearance expanded once, by the id it has in the document. -/// In "group copies" the two copies of the square share an id until Expand Appearance gives them -/// ids of their own, and the reply names the group, then each copy by its new id. +/// The reply lists each object whose appearance expanded once, by the id it has in the document, +/// starting with the selected object. In "group copies" the two copies of the square share an id +/// until Expand Appearance gives them ids of their own, and the reply names the group, then each +/// copy by its new id. #[test] fn the_reply_names_each_expanded_copy_by_its_own_id() { for case in RANDOM_CASES { @@ -169,6 +170,7 @@ fn the_reply_names_each_expanded_copy_by_its_own_id() { let id = random_transforms(&mut s, case); let r = run(&mut s, "effect.expandAppearance", json!({})); let ids: Vec = r["ids"].as_array().unwrap().iter().map(|v| v.as_u64().unwrap()).collect(); + assert_eq!(ids.first(), Some(&id.0), "{case}: {ids:?}"); let unique: std::collections::HashSet<_> = ids.iter().collect(); assert_eq!(unique.len(), ids.len(), "{case}: {ids:?}"); assert!(ids.iter().all(|&i| s.doc().unwrap().doc.node(NodeId(i)).is_some()), "{case}: {ids:?}");