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:
austinried
2026-10-08 18:52:44 +00:00
parent 4db8645691
commit 7145b9c3c7
2 changed files with 14 additions and 1 deletions
+1 -1
View File
@@ -63,4 +63,4 @@ Everything comes from the Nix flake devshell; do not install toolchains by hand.
- Integration servers: navidrome on 4533 (`admin`/`password`), gonic on 4747 (`admin`/`admin`), lms on 5082 (`admin`/`subtracks-lms`), Nextcloud Music on 8090 (`admin`/`subtracks-nextcloud`, base URL `http://localhost:8090/index.php/apps/music/subsonic/`). The test music is cached in `.integration/music` (gitignored).
- lms and Nextcloud Music authenticate the Subsonic API with per-user **API keys** instead of passwords. The harness seeds a key and most tests use `useTokenAuth = false`; `SubsonicAuthIntegrationTest` drives `useTokenAuth = true` and asserts the fallback to plaintext (lms answers code 42, Nextcloud 41).
- `nix develop` does not source your shell rc files (so tools like atuin are not active); use direnv if you want your normal interactive shell.
- The store screenshots in `metadata/en-US/images/phoneScreenshots/` must be 24-bit no-alpha PNGs (Play rejects palette and alpha PNGs for screenshots); re-encode after regenerating, e.g. `magick in.png -strip -type TrueColor PNG24:out.png`.
- The store screenshots in `metadata/en-US/images/phoneScreenshots/` must be 24-bit no-alpha PNGs (Play rejects palette and alpha PNGs for screenshots). `:app:demoScreenshots` writes its captures in that form, so copy them across as-is and don't run a palette optimizer over them.
@@ -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