-
-
Notifications
You must be signed in to change notification settings - Fork 28
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
KImageView -> hasDrawable doesn't work with SVG images #48
Comments
@filnik could you please create a reproducible PR with this issue? That's a long story but |
See: #32 |
I've created a POC here: https://github.com/filnik/proof_of_concept In particular, here is the test: https://github.com/filnik/proof_of_concept/blob/master/app/src/androidTest/java/com/neato/test/POCInstrumentationTest.kt While here I dynamically set the image: Creating the POC I realized that if I set the image like this:
It works. In any other ways, it doesn't. Unfortunately in my project we are not using viewBinding but dataBinding (I created this project using the default one from Android Studio) so I cannot this solution to fix the problem :( No idea why there is a difference in the two instances. Thank you however for the help! |
I've found the reason of the issue. Using databinding in the POC is fine, but in my project the image has a "scaleType" thus it seems different to the ui test than the one provided. Is there a way to "restore" the image after it has been scaled? The only way I found was putting the second image in the same ImageView and extract from there and to the comparison. Actually not so "clean" but it worked. |
I've used this to make it work: https://pastebin.com/exPRirCU although probably it could be done better. |
I found, that Works fine on view holder with this layout:
And doesn't work with this:
PS: This is a sample of a portion of a complete layout where the root container has other content and the height of the root container depends on it. The image is stretched to the full height of the parent.
|
Steps to reproduce:
Observed Results:
The images are considered different although they are the same
Expected Results:
The images should be the same
Relevant Code:
I've tried also to create a CustomMatcher trying to compare the constantState but it fails anyway unfortunately.
The text was updated successfully, but these errors were encountered: