Got a screenshot of my app rendered like that. Basically replaced my
Window
with
ImageComposeScene
and was able to render and store to file the way you suggested.
I'm still curious whether it's possible or planned to use the testing API similar to the way its possible with Android. I found Maven artifact
org.jetbrains.compose.ui:ui-test-junit4:1.1.1
and was able to change most imports on the Android example in the blog post above so that they resolve.
What does not seem to be available is
captureToImage()
, I'm assuming it's going to be added eventually:
onRoot()
.captureToImage()
.asAndroidBitmap()
.save(file)
Why I'm interested in this: the testing API also has support for simulating clicks on UI elements, so I guess it will help making series of screenshots from various parts of the UI without needing to manipulate state internally, but can be manipulated by simulated mouse and key events.