diff --git a/common/src/app/common/test_helpers/composable/oracle.cljc b/common/src/app/common/test_helpers/composable/oracle.cljc index 62f6ce0fc6..293db99eca 100644 --- a/common/src/app/common/test_helpers/composable/oracle.cljc +++ b/common/src/app/common/test_helpers/composable/oracle.cljc @@ -525,7 +525,17 @@ (= group :geometry-group) ;; The source copy stays in its own frame. Existing geometry ownership ;; and tolerance apply; I4 then checks its placement against the main. - (let [attrs (geometry-differences source-objects kept source source)] + (let [source-parent (get source-objects (:parent-id source)) + kept-parent (get objects (:parent-id kept)) + ;; a parent the push only moves, as a layout does a variant, carries the copy along + source (cond-> source + (and source-parent kept-parent + (= (:id source-parent) (:id kept-parent)) + (mth/close? (:width source-parent) (:width kept-parent) 0.01) + (mth/close? (:height source-parent) (:height kept-parent) 0.01)) + (gsh/move (gpt/subtract (first (:points kept-parent)) + (first (:points source-parent))))) + attrs (geometry-differences source-objects kept source source)] (when (or (seq attrs) (not= (or (:content-scale source) 1) (or (:content-scale kept) 1))) (mismatch id group (shadow/values source group) (shadow/values kept group)))) diff --git a/common/test/common_tests/logic/composable_gen_test.cljc b/common/test/common_tests/logic/composable_gen_test.cljc index 6f88614a8f..cf88501403 100644 --- a/common/test/common_tests/logic/composable_gen_test.cljc +++ b/common/test/common_tests/logic/composable_gen_test.cljc @@ -1821,6 +1821,13 @@ :ops [[:combine 0] [:switch 10] [:text-style 6 0 1] [:text-style 12 8 1] [:edit 3 0 1 1] [:update-main 3]]})))) +(t/deftest updating-a-main-from-a-copy-in-a-variant-it-moves-keeps-the-copy-in-place + (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 [[:nest 0 0 0 0] [:rotate 0 0 0 0] [:make-variant 0 0 0 0] [:swap 0 0 0 0] + [:duplicate 0 0 0 0] [:text-style 0 0 1] [:update-main 0 0 0 0]]})))) + (t/deftest random-variant-compositions (let [coverage (atom {}) failure (atom nil)]