-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Should roborazzi use hardware mode? #296
Comments
I'm actually not sure if we should recommend using it since it's not mentioned in Robolectric's release notes. @utzcoz, sorry for mentioning you suddenly, but do you have any information about this? |
A related discussion robolectric/robolectric#8592 I think from that I thought it was released in 4.12 |
@takahirom No worry, you can ping me anytime when you need.
I think we can use hardware mode on macOS, Windows and Linux with Robolectric 4.12+. We can see many related improvements for recent releases: https://github.com/search?q=repo%3Arobolectric%2Frobolectric+HardwareRenderer&type=pullrequests But we also find some hardware mode related issues, for example, RenderEffect Blur related issue: robolectric/robolectric#8955. Also there are some limitations of current RNG: robolectric/robolectric#8955 (comment). Maybe the next Android version supporting will improve them. As I am not th person to participate in the RNG project mainly, so I only can provide my suggestions:
So if you only use one OS to run screenshot testing, like Linux or macOS, or Linux and macOS, you can try to enable it for current test suite and check its behavior. For low-fidelity scenarios, feel free to open issues to Robolectric. So it depends on. Let's ping @hoisie friendly for more professional suggestions. And @hoisie, maybe we can record it to our FAQ? |
@utzcoz is the system property (robolectric.screenshot.hwrdr.native) the only thing needed? That appears to be what chrisbanes/haze#147 is doing. Am I setting it incorrectly, or does HardwareRendererCompat.setDrawingEnabled do something subtly different? |
It only works on API 31+ I’ve updated Android-Screenshot Testing Playground to use hardware native (activated in the gradle file) in case it helps you |
@sergio-sastre Could you help send a PR for Robolectric to add necessary documentation for API requirement? |
I just wanted to let everyone know that we have made some significant bug fixes to HW rendering in the past couple of weeks, and are planning to do a new Robolectric point release (4.12.2) with these fixes. |
Sure I can help, but I am just unsure where should I add it? Should I create a new section in the README.md? |
@sergio-sastre Maybe robolectric.github.io. |
Surprisingly, without the robolectric.pixelCopyRenderMode option, even basic column layouts and some components seem to be affected. It might be best to enable this option when using Roborazzi. |
@takahirom if basic column layouts are not working in SW rendering mode, it may indicate a bug in Compose. I know that the Compose team has deprioritized SW rendering, but I do believe that simple layouts should work. |
We enabled hardware mode in our project, and everything looks good so far, except when using This is what I see in the Compose Preview and what I expected to capture: But this is what it's captured. As you can see the shadow of the card is there, but not the scrim. Not sure if this is related to the hardware mode or the way |
@adrinieto-jt Lines 48 to 66 in 1924d40
|
I noticed that there is a commit indicating that the hardware mode will be set as the default option. |
Possibly related to #290
I had some regressions switching off my own homegrown screenshot code to Roborazzi.
Is roborazzi enabling hardware mode in all cases? Is setting USE_HARDWARE_RENDERER_NATIVE_ENV enough? Do we need to wrap tests with something like
The text was updated successfully, but these errors were encountered: