mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-11 07:29:14 +01:00
test: write the demo screenshots as 24-bit no-alpha PNGs
Re-encode each capture to opaque RGB so the store screenshots copied into metadata/ already satisfy Play's rule, instead of depending on a manual palette-free re-encode.
This commit is contained in:
@@ -72,7 +72,9 @@ import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.annotation.Config
|
||||
import org.robolectric.annotation.GraphicsMode
|
||||
import java.awt.image.BufferedImage
|
||||
import java.io.File
|
||||
import javax.imageio.ImageIO
|
||||
|
||||
/**
|
||||
* Records the store screenshots from a real sync of the public Navidrome demo library. It is not run
|
||||
@@ -269,6 +271,17 @@ class DemoScreenshotTest {
|
||||
composeRule.waitForIdle()
|
||||
}
|
||||
composeRule.onRoot().captureRoboImage("src/test/screenshots/demo/$file")
|
||||
reencodeOpaqueRgb(File("src/test/screenshots/demo/$file"))
|
||||
}
|
||||
|
||||
private fun reencodeOpaqueRgb(file: File) {
|
||||
val decoded = ImageIO.read(file)
|
||||
val rgb = BufferedImage(decoded.width, decoded.height, BufferedImage.TYPE_INT_RGB)
|
||||
rgb.createGraphics().run {
|
||||
drawImage(decoded, 0, 0, null)
|
||||
dispose()
|
||||
}
|
||||
ImageIO.write(rgb, "png", file)
|
||||
}
|
||||
|
||||
@Composable
|
||||
|
||||
Reference in New Issue
Block a user