From 0c1ea0bfc7909d866091e1b57b49e058ba79df64 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Sat, 14 Nov 2026 08:38:19 +0100 Subject: [PATCH] :paperclip: Compare missing and empty fill and stroke lists alike in harness A pasted shape gets empty fill and stroke lists, as the clipboard gives them, while its main and a later sync of it have none. Both show nothing, but the oracle and the model told them apart. Values and design snapshots now take a missing list as an empty one. Harness only; the benchmark is not run. Also in this commit: - The harness changes that check the next commit, "Author the size a resize gives an untouched swapped head". AI-assisted-by: claude-opus-5-5 --- .../common/test_helpers/composable/oracle.cljc | 3 +++ .../common/test_helpers/composable/shadow.cljc | 17 +++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/common/src/app/common/test_helpers/composable/oracle.cljc b/common/src/app/common/test_helpers/composable/oracle.cljc index 21ebbff91e..b8e3ad4a5b 100644 --- a/common/src/app/common/test_helpers/composable/oracle.cljc +++ b/common/src/app/common/test_helpers/composable/oracle.cljc @@ -259,6 +259,9 @@ (as-> snapshot (cond-> (dissoc snapshot :transform :transform-inverse) (#{:fill :auto} (:layout-item-h-sizing shape)) (dissoc :width) (#{:fill :auto} (:layout-item-v-sizing shape)) (dissoc :height)))) + ;; no fills or strokes show as an empty list or none at all + (update :fills #(or % [])) + (update :strokes #(or % [])) (update :constraints-h #(or % (gsh/default-constraints-h shape))) (update :constraints-v #(or % (gsh/default-constraints-v shape))) ;; a deleted component keeps its objects as stored, and sync diff --git a/common/src/app/common/test_helpers/composable/shadow.cljc b/common/src/app/common/test_helpers/composable/shadow.cljc index 9752e59ab7..511ae15054 100644 --- a/common/src/app/common/test_helpers/composable/shadow.cljc +++ b/common/src/app/common/test_helpers/composable/shadow.cljc @@ -118,7 +118,10 @@ (= group :layout-grid-cells) {:layout-grid-cells (grid/get-cells shape)} (contains? text-groups group) {:content (:content shape)} - :else (cond-> (into {} (map #(vector % (get shape %))) (get attributes group)) + ;; no fills or strokes show as an empty list or none at all + :else (cond-> (into {} (map #(vector % (cond-> (get shape %) + (#{:fills :strokes} %) (or [])))) + (get attributes group)) ;; the tokens a shape applies to its corners go with their radius (= group :radius-group) (assoc :applied-tokens (not-empty (select-keys (:applied-tokens shape) n/radius-attrs)))))) @@ -668,11 +671,10 @@ model model)) (defn sync-scaled-heads - "A copy shape that a sync resizes sizes its subtree through constraints. - An untouched swapped head in it that the resize gives another size - authors that size, placed in its parent. The resize starts at the - topmost resized ancestor of the head: a sync resizes only a copy shape - without authored geometry." + "A copy shape that a sync or a transform resizes sizes its subtree through + constraints. An untouched swapped head in it that the resize gives another + size authors that size, placed in its parent. The resize starts at the + topmost resized ancestor of the head." [model before after] (let [sized-alike? #(let [a (geom/boxed %1) b (geom/boxed %2)] (and (mth/close? (:width a) (:width b)) @@ -699,8 +701,7 @@ (not (and (ctl/any-layout-immediate-child? after shape) (not (ctl/position-absolute? shape)))) (some? origin) - (:shape-ref origin) - (not (contains? (get model (:id origin)) :geometry-group))) + (:shape-ref origin)) (assoc-in result [id :geometry-group] (author-geometry shape parent)) result))) model model)))