Repository navigation
What's new
Faster Preview tests
- #177 Support Robolectric-Daemon for faster Preview tests.
Thanks @takahirom for the PR!
Gradle-based scan-result caching
- #115 Support saving the scan result inside a Gradle task for JVM libraries.
- #38 Support saving the scan result in assets inside a Gradle task for instrumentation libraries.
This lets you separate Preview scanning from test execution: run the scan in a Gradle task and use the saved result during test execution.
As a result, Instrumentation Preview screenshot tests no longer need a prior unit test for scanning: the scan can be performed beforehand in a Gradle task.
More accurate Android Preview dimensions
- #164 Improve the accuracy of the dimensions used for rendering Android Previews.
Previously, when converting from Dp to Px or vice versa and back, we accepted a margin error of 2f in ScreenSize/ChinSize dimensions due to rounding. This margin error is gone and such conversions are precise now.
As a result, newly recorded screenshots may have a slightly different size than in previous versions, but they now better reflect the actual Preview dimensions.
New Android Preview device properties
-
#163 Support the new Android Preview device properties introduced in Android Studio Stingray:
windowPosture:flat,tabletop, orbookpointerPrecision:coarse,fine,blunt, ornonekeyboardKind:virtual,physical, ornoneviewingDistance:near,medium, orfarhasCamera:trueorfalsehasMicrophone:trueorfalse
This look something like this inside a Preview:
@Preview( device = "spec:width=673dp,height=841dp," + "windowPosture=tabletop," + "pointerPrecision=fine," + "keyboardKind=physical," + "hasCamera=false," + "hasMicrophone=false," + "viewingDistance=medium" ) -
#163
AI Glassesis now namedDisplay Glassesin device identifiers:@Preview(device = "name:Display Glasses")
Breaking changes
-
#164 Newly recorded screenshots may have a slightly different size due to more accurate Preview dimensions.
Please regenerate your screenshot baselines after upgrading if your tests compare against previously recorded screenshots.No API-breaking changes are expected.