Menu

Your Compose Screenshot Tests Never Run at fontScale 1.3 — and That's Where Your Layout Breaks
📰

Your Compose Screenshot Tests Never Run at fontScale 1.3 — and That's Where Your Layout Breaks

DEV Community: android·YADNYESH RANA·9 days ago
#kHkGoaqT
#devtoandroid#devto#dev#test#paparazzi
Reading 0:00
15s threshold

Spent a while debugging a Compose screenshot test suite that was green on every PR for months, then watched the actual app clip a button label the first time someone bumped their phone's font size to "Larger."

The test suite "passed" the entire time. That's the part worth writing up.

The gap: your snapshots only exist at fontScale 1.0

Most Compose screenshot setups — Paparazzi, Roborazzi, Compose UI's own snapshot tooling — render each @Preview or test composable through one fixed device config. Unless someone deliberately parameterizes it, that config uses fontScale = 1.0f , because that's the default on both the emulator image and DeviceConfig 's own defaults.

That's a real gap, not a hypothetical one: Android's accessibility settings let users scale system font size up to 1.3x ("Larger"), and some OEM skins + the newer non-linear font scaling in Android 14+ push effective scale even higher.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.