-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Drawable comparison test failing #7180
Comments
@nak411 can you print out the contents of those byte arrays in Robolectric 4.3? I suspect they will all be zeros. There were massive improvements to bitmap fidelity, primarily #6147 by @utzcoz. I think this failure is expected behavior on real Android. I copied this test to an emulator, and it also fails: https://gist.github.com/hoisie/bbd9d6cf9f28129030dbd88a8e61c854 I think when you compress something as JPEG, it encodes some transient metadata (maybe date/time?). |
I printed out the bytes in 4.3 and they do have content in them, however the byte array size is the same for both drawables. In 4.7.2, it seems like the call to I understand that the test is correctly failing but I was just wondering what that |
@nak411 Does those two |
@nak411 could you update that code sample to get to the point where it passes in an emulator but fails in Robolectric? |
@utzcoz Thank you for your input. It seems like the issue is with the state. The drawable has a state @hoisie Greatly appreciate the help. The robolectric behavior is consistent with android behavior so this can be closed as a nonissue. The test was actually asserting the wrong thing and was incorrectly passing in the older version of robolectric. |
Description
I have a test that sets a drawable on an image view and then retrieves the drawable and compares its bytes with the expected drawable. In robolectric 4.3.1 this test passed, however I'm now upgrading to robolectric 4.7.2 which is causing the test to fail.
The main issue I'm noticing is that
myImageView.setImageResource(resId)
changes the size of the retrieved bytes when compared with the same drawable in usingcontext.getDrawable(resid)
. This was not the case in 4.3.1Was there any modification made to drawable/bitmaps between 4.7.2 and 4.3.1 that would cause this test to fail?
Steps to Reproduce
Robolectric & Android Version
Robolectric Version: 4.7.2
Android Target SDK: 30
Link to a public git repo demonstrating the problem:
The entire issue is reproducible in the linked code.
The text was updated successfully, but these errors were encountered: