Join Slack
hey guys. can someone help me with unit tests in Compose + Coil image loading? I answered my own que...
# compose
n
nglauber
07/22/2022, 2:31 PM
hey guys. can someone help me with unit tests in Compose + Coil image loading? I answered my own question here and I would like to know if I’m doing right…
https://stackoverflow.com/questions/73044642/how-to-unit-test-if-an-image-was-loaded-using-coil-compose/73080538#73080538
y
yschimke
07/22/2022, 6:51 PM
If you want to avoid special syntax in your composables to hang your tests off, you could use EventListener.
yschimke
07/22/2022, 6:52 PM
https://coil-kt.github.io/coil/api/coil-base/coil-base/coil/-event-listener/index.html
n
nglauber
07/22/2022, 7:14 PM
Sorry, could you elaborate?
y
yschimke
07/22/2022, 8:32 PM
If you set an event listener on your test image loader, you can just see that you get a success result after its rendered.
yschimke
07/22/2022, 8:32 PM
Just another option.
n
nglauber
07/22/2022, 8:54 PM
I got your point. My question is: how can I get the
painter
object in the test, listen to state changes and do the assertion with the success state?
27
Views
Open in Slack
Previous
Next
kotlinlang
A modern programming language that makes developers happier.
Powered by