openpencil/tests/engine/layout/auto-layout
Danila Poyarkov 11e708de39
fix(layout): size each axis on its own and lay out before geometry reads (#942)
* fix(figma-api): lay out pending edits before geometry reads

Scripts read x, y, width, height, transforms, and bounds as they were before the script ran until the tool finished and laid out its changes. Figma lays out on read, so a hugging parent reports its new size right after a child is added.

The graph now records the scope of edits outside layout application, and the geometry getters lay that scope out first through the same runner tools use after a call. One recorder exists per graph; a new FigmaAPI starts it afresh because the editor lays out its own edits.

* fix(layout): size each axis on its own, as Figma does

Fill is stored on the child, as layoutGrow along the parent's primary axis and STRETCH across it, with a grid laid out like a row; primaryAxisSizing and counterAxisSizing only fix or hug. A shared layoutSizing helper in scene-graph reads and writes per-axis sizing, and layout, the Figma API, the properties panel, design JSX, DOM/CSS export, and .pen import use it.

This fixes grid children filling both axes when set to fill one, auto-layout children that stretch but kept a fixed size, the Figma API writing Fill to a frame's own sizing (which .fig export dropped), and JSX and HTML exports losing grid and cross-axis fill. Behavior was checked against live Figma, and imported layouts were compared with the geometry stored in material3.fig and nuxtui.fig.

* fix(layout): keep pending edits until laid out and opt out of inherited stretch

A new FigmaAPI cleared the edits recorded on its graph, so after a script failed before its tool laid out its changes, the next script read stale geometry; edits now stay recorded until a read lays them out, and return to the record if that layout throws. Setting a child to Fixed or Hug across a parent that stretches every child left it filling; it now opts out with MIN, as frame presets do.
2026-10-07 11:52:08 +00:00
..
absolute test: move prefixed splits into domain folders 2026-05-06 14:27:21 +03:00
alignment fix(fig): improve imported component layout parity 2026-08-03 18:00:15 +03:00
counter-axis test: move prefixed splits into domain folders 2026-05-06 14:27:21 +03:00
fill fix(layout): size each axis on its own and lay out before geometry reads (#942) 2026-10-07 11:52:08 +00:00
gap test: move prefixed splits into domain folders 2026-05-06 14:27:21 +03:00
hidden-children test(layout): place auto-layout reflow cases by domain 2026-07-02 10:16:08 +03:00
horizontal test: move prefixed splits into domain folders 2026-05-06 14:27:21 +03:00
imported-derived-layout feat(fig): support text on path 2026-08-17 12:00:01 +03:00
layout fix(layout): size each axis on its own and lay out before geometry reads (#942) 2026-10-07 11:52:08 +00:00
layout-align-self test: move prefixed splits into domain folders 2026-05-06 14:27:21 +03:00
min-max test: move prefixed splits into domain folders 2026-05-06 14:27:21 +03:00
mixed test: move prefixed splits into domain folders 2026-05-06 14:27:21 +03:00
nested fix(layout): preserve imported instance child bounds 2026-06-03 15:47:17 +03:00
self test: move prefixed splits into domain folders 2026-05-06 14:27:21 +03:00
sizing test: move prefixed splits into domain folders 2026-05-06 14:27:21 +03:00
text test: typecheck the test suites and fix what that found (#896) 2026-10-05 12:42:38 +00:00
vertical test(layout): place auto-layout reflow cases by domain 2026-07-02 10:16:08 +03:00
wrap test: move prefixed splits into domain folders 2026-05-06 14:27:21 +03:00
edge-cases.test.ts test(layout): split auto-layout coverage 2026-05-06 14:10:20 +03:00