Assigned
Status Update
Comments
da...@google.com <da...@google.com>
hu...@google.com <hu...@google.com>
ys...@google.com <ys...@google.com> #2
I tried adding screenshotTestImplementation(libs.androidx.window)
but it didn't fix it.
ls...@gmail.com <ls...@gmail.com> #3
This is likely a duplicate of libs.androidx.window
dependency to implementation
to see if it works?
mi...@gmail.com <mi...@gmail.com> #4
Actually there is still a bug in setting locale in the @Preview annotation: it is not applied to date or number formatting.
Description
When some Compose code uses the
Locale.getDefault()
method, the screenshot generation process uses the default locale of the local host machine.This behavior is acceptable when previewing in Android Studio but can be counter-intuitive in screenshot testing scenarios, since the locales configured on developers machines and on CI servers are often different.
As an example, consider the DatePicker widget from Material 3. Create a Preview for screenshot testing with this widget:
Generate reference images using a specific locale:
The images will be generated using the Spanish locale. Validation of these screenshots on a host with a different locale will fail:
It would be more convenient if the default application locale was used, as is already done for Android resources.
Compose Preview Screenshot Testing plugin version: 0.0.1-alpha01
System information automatically generated when creating a bug report: