From de5398cfc589683e0ba3fd7cd5db77f11cc2af4f Mon Sep 17 00:00:00 2001 From: Simon Koch-Sultan <126534658+scks1@users.noreply.github.com> Date: Sun, 8 Nov 2026 09:01:24 -0500 Subject: [PATCH] engine: nested ungroup test compares site counts and checks the selection The test compared each shape's connection sites before and after through zip, which stops at the shorter list, so a shape that lost sites would still pass. It now checks the counts first. The case with three nested groups also checks that the freed shapes are selected. --- crates/engine/src/tests.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 771268ae4..6a4882839 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -932,6 +932,7 @@ fn ungrouping_a_nested_group_frees_its_shapes_into_the_outer_group() { assert_eq!(order, [sid(a), sid(b), sid(c)], "case {n}"); for (id, was) in [a, b, c].into_iter().zip(before) { let now = sites(&s, id); + assert_eq!(was.len(), now.len(), "case {n}: shape {id}"); assert!(was.iter().zip(&now).all(|(p, q)| (*p - *q).hypot() < 1e-6), "case {n}: shape {id} moved from {was:?} to {now:?}"); } } @@ -947,11 +948,13 @@ fn ungrouping_a_nested_group_frees_its_shapes_into_the_outer_group() { let before = [a, b, c, d].map(|id| sites(&s, id)); let r = s.execute("arrange.ungroup", &json!({"ids": [inner, middle]})).unwrap(); assert_eq!(r["ids"], json!([a, b, c])); + assert_eq!(s.doc().unwrap().selection.shapes, [sid(a), sid(b), sid(c)]); let st = s.doc().unwrap(); let order: Vec = deckcraft_model::find_shape(st.shapes(), sid(outer)).unwrap().children().iter().map(|x| x.id).collect(); assert_eq!(order, [sid(a), sid(b), sid(c), sid(d)]); for (id, was) in [a, b, c, d].into_iter().zip(before) { let now = sites(&s, id); + assert_eq!(was.len(), now.len(), "shape {id}"); assert!(was.iter().zip(&now).all(|(p, q)| (*p - *q).hypot() < 1e-6), "shape {id} moved from {was:?} to {now:?}"); } }