diff --git a/common/src/app/common/test_helpers/composable/shadow.cljc b/common/src/app/common/test_helpers/composable/shadow.cljc index 6a5ef7a71b..54af0bb30f 100644 --- a/common/src/app/common/test_helpers/composable/shadow.cljc +++ b/common/src/app/common/test_helpers/composable/shadow.cljc @@ -751,10 +751,14 @@ (placed-flips main (get after (:parent-id main)) new-parent)) (and (not root?) (= :geometry-group group) new-parent) (in-orientation (get after (:parent-id main)) new-parent)) + ;; the old main as the old copy showed it, in the + ;; same frame as `placed` old-placed (cond-> old-main (and root? (= :geometry-group group)) (merge {:rotation old-placed-rotation} - (placed-flips old-main (get before (:parent-id old-main)) old-parent))) + (placed-flips old-main (get before (:parent-id old-main)) old-parent)) + (and (not root?) (= :geometry-group group) old-main old-parent) + (in-orientation (get before (:parent-id old-main)) old-parent)) old (if (= :geometry-group group) old-resized old) orientation #{:rotation :flip-x :flip-y} ;; the head's turn and flips carry as one: only where the diff --git a/common/test/common_tests/logic/composable_gen_test.cljc b/common/test/common_tests/logic/composable_gen_test.cljc index ef93e20bea..888ac5b8e4 100644 --- a/common/test/common_tests/logic/composable_gen_test.cljc +++ b/common/test/common_tests/logic/composable_gen_test.cljc @@ -1945,6 +1945,17 @@ [:swap 12 0 0 0] [:make-variant 4] [:switch 9] [:switch 16 0 0 0] [:combine 7] [:switch 11]]})))) +(t/deftest switching-a-turned-copy-keeps-the-turn-its-child-authors + (t/is (map? (cg/run {:world [2 0 {:variants true :text-styles true :library-variants true :stale-libraries true + :layout :flex :layout-item-margins false :grid-square false :library-depth 1 + :library true :rich-variants true :layout-children true :library-text true + :grid-empty false :layout-copies true :text true}] + :ops [[:nest 3 0 0 0] [:library-add-child 0] [:library-sync] [:remove-child 5 0 0 0] + [:library-delete 2 0 0 0] [:library-combine 10] [:library-sync] [:switch 10] + [:library-add-variant 1 0 0 0] [:transform 12 3 0 7] [:library-add-variant 1 0 0 0] + [:library-add-variant 0 0 0 0] [:library-transform 0 3 4 0] [:library-add-child 5] + [:library-sync] [:library-variant-property 0 0 0 0] [:library-sync] [:switch 10]]})))) + (t/deftest random-variant-compositions (let [coverage (atom {}) failure (atom nil)]