-
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
Different screenshot result on MacOS/Ubuntu/Windows #351
Comments
Thank you for reporting this issue. A practical solution would be to adapt your CI environment to record screenshots. This method aligns with what's been implemented in Now in Android, ensuring consistency by using the same environment for both recording and testing screenshots. This approach should help mitigate the discrepancies caused by platform-dependent rendering behaviors. |
I'll add this problem and the suggested solution to the FAQ section in the README to help others who might encounter the same issue. |
Good timing :) My team was just running into this since a couple of us started working with Macs |
@dalapenko @timothyfroehlich |
Let me try running that on my system. Our screenshots were recorded on Ubuntu and I have a Macbook |
I will test it after tomorrow on my sample project and publish result this. But if it’s can’t guarantee 100% equaled screenshot on different platform on normal usage I don’t think that needed made this option default valued |
I tested on my sample project from this issue with two type of view - simple material button and more complicated custom view with shapeable image view. Views is not Compose - simple xml layout. With hShift = 0 result is: Simple material button without HW render (robolectric.pixelCopyRenderMode not set as hardware)
Complicated shapeable image with HW render (robolectric.pixelCopyRenderMode set as hardware)
then i change hShift to 1 and result pleasantly surprised - all tests is passed: Simple material button without HW render (robolectric.pixelCopyRenderMode not set as hardware)
Complicated shapeable image with HW render (robolectric.pixelCopyRenderMode set as hardware)
after this tests i'm change opinion and changing default value of hShift property looks like good update for tool |
Thank you for your excellent investigation, dalapenko! Your thorough testing has provided invaluable insights. Based on these impressive results, we're considering making hShift = 1 the new default setting. |
I finally tried it, after figuring out how to change the setting without needing to modify the roborazzi repo. (Note that the PR numbers are out of order because I had to untangle some git history that I'd botched) In google/automotive-design-compose#1499 I made two changes: I added the comparator option to set hShift to 1, and I re-recorded my screenshots on my MacBook (M3) and checked those in. In google/automotive-design-compose#1498 I removed the hShift option, re-recorded (which did not change the screenshots as expected) and uploaded that. Our GitHub actions are all Ubuntu, so the test results on the PRs are comparing committed Mac screenshots with code built/run on Ubuntu. You can see from our snapshot diff action that there isn't any apparent image diff, but the |
Also ran verify on m MacBook ywith hShift=1 on our main branch (so with Linux-generated screenshots) and got numerous failures:
|
Ah damn it, that's a new test and the creator didn't add the roborazzi rule. False alarm, redoing the test. |
@takahirom Here's a new PR with the screenshots recorded on my Macbook and hShift set to 1. The diffs in the comments will be the GitHub Ubuntu runners comparing their results with my Macbook's recorded screenshots. google/automotive-design-compose#1523 I could also put up a PR with a compare job running on a Mac Arm runner if that would help. |
I've made test on different platforms and saw that references made on one of platform may failed when use verify on other.
In my repository I wrote two test for three platform
Simple material button without hardware render: https://github.com/dalapenko/ShapeableRobolecticBug/blob/87388e1236f8d656456b2d07947fe62ddb29f619/app/src/test/java/tech/dalapenko/shapeablebug/SimpleViewNoHWRednerTest.kt
Shapeable custom view with hardware render: https://github.com/dalapenko/ShapeableRobolecticBug/blob/87388e1236f8d656456b2d07947fe62ddb29f619/app/src/test/java/tech/dalapenko/shapeablebug/ShapeableViewHWRednerTest.kt
and test it on three platforms. I was surprised that MacOS and Ubuntu system has same problem as Windows. On Windows was failed screenshot references of simple material button made on Mac/Ubuntu, but this references will be similar for Mac and ubuntu respective. On Mac was failed screenshot references of shapeable custom view made on Windows/Ubuntu and for Ubuntu/Windows it was across similar.
Material Button compare on MacOS of Windows ref
Shapeable custom view compare on MacOS of Windows ref
Shapeable custom view compare on MacOS of Unbuntu ref
I've understand that root of problem probably in Robolectric lib, but may be this information useful for growth of Roborazzi lib or may be you already know appropriate issue in Robolectric.
As workaround I found just increase changeThreshold
The text was updated successfully, but these errors were encountered: