1.37.0
Bug Fixes and Workarounds
Compose AlertDialog Support
Support for capturing Alert Dialogs has been fixed, ensuring correct screenshot display. captureScreenRoboImage()
, which merges all windows, is now used only when multiple windows are present. Thanks to @ashughes for reporting this and to @mhidaka and @hiroaki404 for bringing it to my attention at a Japan Android testing event.
Workaround for Overlap Handling for SDK 35 Compose Screenshots
Problem
When updating to SDK 35 and using the default theme, the ActionBar is included in screenshots, leading to overlap when using createComposeRule()
. This occurs because createComposeRule()
uses the default theme by default. Thank you for letting me know about this, @keyboardsurfer!
I have filed an issue for this: https://issuetracker.google.com/issues/383368165
Why this happens
SDK 35 enforces edge-to-edge display, which means it does not provide automatic padding for the ActionBar.
How Roborazzi currently workarounds this
Roborazzi now automatically hides the ActionBar when taking screenshots on SDK 35 and higher. This functions similarly to view.getActivity()?.actionBar?.hide()
. However, this workaround may cause performance issues and should not be relied upon. Roborazzi outputs warning logs with alternative suggestions. Thank you to @sergio-sastre for advising on this workaround!
If you need to include the ActionBar in screenshots, Roborazzi provides a flag, roborazzi.compose.actionbar.overlap.fix=false
, that can be added to your gradle.properties
file.
What should we do?
A permanent solution will likely require changes from Google. In the meantime, adding <application android:theme="@style/android:Theme.Material.Light.NoActionBar" />
to the module's src/test/AndroidManifest.xml
file changes the Activity's default theme and resolves the issue. Thank you to @mattinger for finding this!
Stabilized Output for Dump Screenshots
Thanks to @siarhei-luskanau for contributing an improvement that reduces unnecessary diffs for the Roborazzi dump feature.
New Features
Add inspectionMode()
for Compose Previews
Thanks to @YusukeMoriJapan's contribution, inspectionMode()
is now available in RoborazziComposeOptions
. This is particularly useful when working with libraries that have specific preview implementations. This mode is off by default to maintain high fidelity.
Here's how to enable it:
captureRoboImage(
roborazziComposeOptions = RoborazziComposeOptions {
inspectionMode(true)
}
) {
...
}
What's Changed
- Fix document build by @takahirom in #597
- Sort units and actions of ComposePrintToString to stabilize output in Dump screenshots. by @siarhei-luskanau in #600
- Update API version for sample by @takahirom in #601
- add localInspectionMode property to RoborazziComposeOptions by @YusukeMoriJapan in #588
- [Refactor] Separate compose lambda test by @takahirom in #606
- Add elevation for PreviewNormal preview test by @takahirom in #608
- Fix alert dialog support by @takahirom in #555
- Add default theme test by @takahirom in #603
- Revert compileSdk and targetSdk for library by @takahirom in #609
- Add overlap workaround by @takahirom in #604
New Contributors
- @siarhei-luskanau made their first contribution in #600
Full Changelog: 1.36.0...1.37.0