diff --git a/common/src/app/common/test_helpers/composable/shadow.cljc b/common/src/app/common/test_helpers/composable/shadow.cljc index 54af0bb30f..dfa6d29e65 100644 --- a/common/src/app/common/test_helpers/composable/shadow.cljc +++ b/common/src/app/common/test_helpers/composable/shadow.cljc @@ -498,8 +498,10 @@ (and (:shape-ref ref) (seq groups)) (update (:id ref) merge (cond-> (grid/remap-groups groups (grid/get-child-map after shape ref)) - (= (:component-id ref) - (:component-id (get after (:shape-ref ref)))) + ;; a clone of the copy shape keeps the swap it authored against the same main + (and (= (:component-id ref) + (:component-id (get after (:shape-ref ref)))) + (not= (:shape-ref ref) (:shape-ref shape))) (dissoc :swap-group))))] (reduce #(push %1 %2 content?) result (:shapes shape))))] (push model root-id false))) @@ -534,7 +536,10 @@ (if-let [expected (authored-placement (:geometry-group groups) new-parent)] (assoc-in result [id :geometry-group] (with-meta (values expected :geometry-group) (meta (:geometry-group groups)))) - (update-in result [id :geometry-group] in-orientation parent new-parent (geom/turn-sign old))) + (let [geometry (:geometry-group groups) + ;; the way the authored rotation, not the one `old` stores, decomposes its transform + sign (geom/turn-sign (merge old (select-keys geometry [:rotation :flip-x :flip-y])))] + (update-in result [id :geometry-group] in-orientation parent new-parent sign))) result))) model model)) diff --git a/common/test/common_tests/logic/composable_gen_test.cljc b/common/test/common_tests/logic/composable_gen_test.cljc index cf1c2f98e7..7fe97f46b0 100644 --- a/common/test/common_tests/logic/composable_gen_test.cljc +++ b/common/test/common_tests/logic/composable_gen_test.cljc @@ -1964,6 +1964,24 @@ [:nest 19 0 0 0] [:grid-direction 9 0 3 0] [:nest 8 0 0 0] [:add-variant 0] [:switch 12] [:make-variant 2] [:switch 14]]})))) +(t/deftest turning-a-flipped-copy-turns-a-child-stored-as-the-other-mirror-turn + (t/is (map? (cg/run {:world [2 2 {:variants true :text-styles true :layout nil :variant-diff false + :layout-item-margins false :grid-square false :rich-variants true + :layout-children false :grid-empty false :layout-copies true :text true}] + :ops [[:swap 5 0 0 0] [:delete 8 0 0 0] [:delete 5 0 0 0] [:combine 7 0 0 0] + [:restore 0 0 0 0] [:add-variant 5] [:switch 0] [:combine 0] [:switch 3] + [:make-variant 14] [:switch 2] [:duplicate 0 0 0 0] [:delete 4 0 0 0] + [:add-variant 7 0 0 0] [:transform 15 1 0 2] [:combine 0] [:switch 1] + [:duplicate 1 0 0 0] [:transform 1 4 0 4] [:variant-property 0 0 0 0] + [:switch 6] [:rotate 10 0 0 0] [:rotate 1 0 0 0]]})))) + +(t/deftest updating-a-main-keeps-a-pushed-swap-its-main-converged-to + (t/is (map? (cg/run {:world [2 2 {:variants true :text-styles true :layout nil :variant-diff false + :layout-item-margins false :grid-square false :rich-variants true + :layout-children false :grid-empty false :layout-copies true :text true}] + :ops [[:make-variant 1] [:switch 11] [:make-variant 2] [:switch 10] [:swap 1 0 0 0] + [:update-main 0 0 0 0]]})))) + (t/deftest random-variant-compositions (let [coverage (atom {}) failure (atom nil)]