theapache64
03/30/2021, 5:25 PMColton Idle
03/30/2021, 9:54 PMTheMrCodes
03/31/2021, 10:21 AMIgor Demin
03/31/2021, 3:21 PMJust wanted to take a screenshotYou can use
TestComposeWindow
š
val window = TestComposeWindow(width = 1024, height = 768)
window.setContent {
}
File(path).writeBytes(window.surface.makeImageSnapshot().encodeToData()!!.bytes)
SwingUtilities.invokeLater
. We will fix this in this issueTheMrCodes
03/31/2021, 3:40 PMIgor Demin
03/31/2021, 3:43 PMWould be really cool if this would find its way into the test documentationVery good idea, thanks š https://github.com/JetBrains/compose-jb/issues/368#issuecomment-811166809
skia surface, print our components to it and take a screenshot from that? (without creating a whole window)
TestComposeWindow
does exactly that. It doesn't create a whole window.TheMrCodes
03/31/2021, 3:45 PMIgor Demin
03/31/2021, 3:45 PMSwingUtilities.invokeLater
is needed because we don't properly handle mutableStateOf
observations in other threads than Swing thread.