Skip to content

fix(snapshots): Render previews with explicit width and height in normal mode - #1457

Merged
runningcode merged 2 commits into
mainfrom
no/snapshots-sized-preview-rendering-mode
Sep 23, 2026
Merged

runningcode merged 2 commits into
mainfrom
no/snapshots-sized-preview-rendering-mode

Conversation

@runningcode

@runningcode runningcode commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Previews that set both widthDp and heightDp failed to snapshot when they contained a LazyRow, LazyColumn, or any layout that can't handle an infinite max constraint.

The generated test rendered these previews with RenderingMode.FULL_EXPAND, which measures the root with unbounded constraints in both directions, so scrollables throw Horizontally/Vertically scrollable component was measured with an infinity maximum ... constraints.

The device screen is already sized to widthDp x heightDp, so NORMAL renders the preview at exactly that size, matching Android Studio.

Reproduced with SAGP 6.21.0 + Paparazzi 2.0.0-alpha05 and confirmed that with NORMAL all previews pass and previously passing snapshots keep the same pixel dimensions.

Why no tests? This repo is currently Java 17 but Paparazzi requires java 21 so we can't write any tests right now :'(

Fixes #1456

🤖 Generated with Claude Code

…mal mode

Previews that set both widthDp and heightDp were rendered with
FULL_EXPAND, which measures the root with unbounded constraints. Lazy
lists and other scrollables throw on infinite constraints, so these
snapshot tests failed. The screen is already sized to the preview
dimensions, so NORMAL renders them at exactly that size.

Fixes #1456

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@runningcode runningcode added the sanity-check PR needs a lightweight review for obvious issues label Sep 23, 2026

@markushi markushi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@runningcode
runningcode merged commit 1eb84d8 into main Sep 23, 2026
30 checks passed
@runningcode
runningcode deleted the no/snapshots-sized-preview-rendering-mode branch September 23, 2026 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sanity-check PR needs a lightweight review for obvious issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Snapshots failing for previews that specify both width and height

2 participants