diff --git a/common/src/app/common/test_helpers/composable/shadow.cljc b/common/src/app/common/test_helpers/composable/shadow.cljc index c849b527c1..0f8dd60d25 100644 --- a/common/src/app/common/test_helpers/composable/shadow.cljc +++ b/common/src/app/common/test_helpers/composable/shadow.cljc @@ -190,6 +190,10 @@ parent) placed (when (and objects (not (:sized? (::position (meta expected))))) (authored-placement expected parent shape)) + ;; an authored size follows its parent's later resizes through its + ;; constraints too, though its place is not authored + sized-placed (when (and objects (:sized? (::position (meta expected)))) + (authored-placement expected parent shape)) ;; a group or bool takes its corners from its children: at its ;; expected corners, its turn and flips say nothing more derived (and (#{:group :bool} (:type shape)) @@ -241,6 +245,8 @@ ;; a recorded place sizes it through its constraints as its parent resizes (and (#{:width :height} key) placed (number? actual)) (mth/close? (get placed key) actual 0.01) + (and (#{:width :height} key) sized-placed (number? actual)) + (mth/close? (get sized-placed key) actual 0.01) (#{:flip-x :flip-y} key) (= (boolean value) (boolean actual)) ;; under one flip, either order of turn and flip stores the opposite turn (and (= :rotation key) (number? value) (number? actual) diff --git a/common/test/common_tests/logic/composable_gen_test.cljc b/common/test/common_tests/logic/composable_gen_test.cljc index 780590be1e..ea9e84ba2d 100644 --- a/common/test/common_tests/logic/composable_gen_test.cljc +++ b/common/test/common_tests/logic/composable_gen_test.cljc @@ -2598,6 +2598,12 @@ :layout-copies false :text true}] :ops [[:grid-cell 13] [:grid-track 0 0 11] [:grid-track 0 3] [:add-child 8] [:grid-track 0 2]]})))) +(t/deftest an-authored-size-follows-a-resize-of-its-main-through-its-constraint + (t/is (map? (cg/run {:world [1 0 {:variants true :layout :grid :layout-item-margins false :grid-square false + :rich-variants false :layout-children false :grid-empty false + :layout-copies false :text false}] + :ops [[:duplicate] [:swap] [:resize] [:resize 2] [:style 0 9 1] [:edit 2 0 0 1] [:update-main 2]]})))) + (t/deftest settling-a-bool-in-a-grid-copy-twice-keeps-its-shapes-in-place (t/is (map? (cg/run {:world [3 0 {:variants true :rich-variants true :text true :layout :grid :layout-copies true :layout-children true}]