Repository navigation
feat(shot): report the device's brightness and text scale with --brightness and --text-scale - #51
Merged
Merged
Conversation
…htness and --text-scale shot --brightness dark and --text-scale <scale> (and semantics, and shot(brightness:, textScale:)) report that platform brightness and text scale, as a device's settings, to every preview that sets none of its own; a preview's brightness or textScaleFactor wins. A --widget shot, which has no Preview to set them, is shot dark or with larger text this way. The run records brightness and text_scale when not the default, shot prints them, and diff prints both runs' when they differ and returns them as ShotSetup.brightness and ShotSetup.textScale; they are not part of shot ids. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
flutter test multiplies every font size by the text scale, as iOS does, while Android 14 and later convert each size through the system's own font scaling, so an Android shot at a scale other than 1 can differ in size from the device. A dark shot also needs a shell that sets the app's darkTheme; the default shell sets none. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Stacked on #50.
flutter testreports a light platform brightness and a text scale of 1. A preview can set its own through@Preview(brightness:, textScaleFactor:), but a--widgetshot has noPreviewto set them, so a widget shot without a preview file could not be checked in dark mode or with larger text, and a preview file without them had to be edited to be shot that way.How it works
shutter shot --brightness darkand--text-scale <scale>(andsemantics) report that brightness and text scale, as the device's settings; from Dart,shot(brightness: ShotBrightness.dark, textScale: 1.3). The defaults stay light and 1.platformBrightnessTestValueandtextScaleFactorTestValuefrom the preview's ownbrightness/textScaleFactor, else from the run's, so a preview made for light stays light under--brightness dark.shootrejects a text scale that is not > 0 and finite with exit 64; the CLI rejects one that is not a number, and any brightness butlightordark.brightness: darkandtext_scaleinmanifest.jsonwhen not the default,shotprints them, anddiffprints both runs' when they differ and returns them asShotSetup.brightnessandShotSetup.textScale. They are not part of shot ids.ShotBrightnessis exported.Tests
test/e2e/device_test.dart: a preview without its own settings readsMediaQuery.platformBrightnessOfas dark andtextScalerOf(context).scale(10)as 13 under--brightness dark --text-scale 1.3, and neither without them; a preview withbrightness: Brightness.light, textScaleFactor: 1keeps them, sodiffreports itunchangedand printsbrightnessandtext_scale.Docs
doc/manual.mdgains a Brightness and text scale section; the drawing model, runs, output, and commands name the options.doc/agent.md, the README, and the CHANGELOG cover them.🤖 Generated with Claude Code