Skip to content

example: Resize screen + e2e test for width/height (all capture strategies) - #731

Merged
gre merged 1 commit into
masterfrom
example-resize-cases
Oct 24, 2026
Merged

gre merged 1 commit into
masterfrom
example-resize-cases

Conversation

@gre

@gre gre commented Oct 24, 2026

Copy link
Copy Markdown
Owner

Follow-up to #730: adds example + e2e coverage so width/height resizing is checked for every capture strategy, on every platform.

What

  • New "📐 Resize" screen (Home → Rendering correctness). Captures a 200×100 four-quadrant view (red / blue / green / yellow) with the default strategy and with useRenderInContext, each at natural size, 100×50 and 400×200.
  • In-app verification. Each capture (result: 'base64') is decoded with Skia, already a dependency of the example. The screen samples the centre of each quadrant and checks the aspect ratio, then shows PASS/FAIL per case plus an ALL PASS / SOME FAILED summary. A cropped (smaller size) or padded (larger size) capture fails.
  • example/e2e/tests/resize.test.js opens the screen, taps capture and asserts every case shows PASS.

Verified locally

result
iOS (iPhone 17 Pro sim), master before #730 ✕ fails at ric-smaller (top-left quadrant only); ric-larger is padded
iOS, with #730 (now merged) ✓ e2e test passes
Android (Pixel 3a API 34 emulator, old arch) all 6 cases PASS on screen (useRenderInContext is iOS-only and ignored)

Notes

  • iOS captures are tagged Display P3 and Skia's readPixels returns the raw bytes (pure green reads about rgb(117,252,76)), so colours are matched to the nearest quadrant colour instead of exact thresholds.
  • The test navigates with swipes like viewshot-all-screens. The shared scrollToElement helper fails on the home ScrollView on iOS ("not scrollable at the given start point"), which is also why style-filters and snapshot-content-container currently fail in the (non-blocking) iOS Detox job.
  • Android Detox is disabled on CI, and the home list didn't scroll under Detox locally, so Android was checked by driving the screen directly.
  • Existing difference, out of scope here: Android treats width/height as pixels (100×50 → 100×50 px), iOS as points (100×50 → 300×150 px at 3x). The screen checks the aspect ratio, so it passes on both.

🤖 Generated with Claude Code

New "Resize" screen (Rendering correctness) captures a four-quadrant view
with the default strategy and with useRenderInContext, at natural size,
100x50 and 400x200. Each capture is decoded with Skia and its quadrant
colors and aspect ratio are checked in-app (PASS/FAIL per case), so a
cropped or padded capture is caught on any platform.

e2e/tests/resize.test.js asserts every case reports PASS. It navigates
with swipes, as viewshot-all-screens does, since Detox scroll fails on
the home ScrollView on iOS.

Covers the iOS useRenderInContext crop/pad bug fixed by #730.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@gre
gre requested a balanced review from Copilot October 24, 2026 09:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@gre
gre marked this pull request as ready for review October 24, 2026 10:58
@gre
gre merged commit 2ce3101 into master Oct 24, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants