Do any of you do screenshot testing with URL loade...
# compose
k
Do any of you do screenshot testing with URL loaded images instead of resources or drawn placeholders? Doesn't look like Paparazzi or Roborazzi support this so it'd have to be instrumented tests w/ Dropbox Dropshots or Facebook's screenshots library? Normally images would be in resources but some resources for us are on CDNs to reduce app size. Hoping the upcoming Google AGP one supports this...
t
I'm not certain, but I believe using .size(Size.ORIGINAL) in the test could provide a workaround to Roborazzi. https://github.com/coil-kt/coil/issues/1910
k
Hmm..I was trying to stick w/ Android classes as much as possible loading images. I saw this error which means Robolectric doesn't support the Android image decoder:
Copy code
--- Failed to create image decoder with message 'unimplemented'
--- Failed to create image decoder with message 'unimplemented'
using basically this code via a LaunchedEffect:
Copy code
val inputStream: InputStream = URL(url).openStream()
            val bufferedInputStream = BufferedInputStream(inputStream)
            val bitmap = BitmapFactory.decodeStream(bufferedInputStream)
which then updates an ImageBitmap with
bitmap.asImageBitmap()
Sounds like Coil doesn't work much better... 😞
👀 1
t
This issue might be related to Robolectric. If you could create a reproducible project, that would be immensely helpful.
👍 1