From 7145b9c3c7a9a141343cb7a8c24011894a3e6a24 Mon Sep 17 00:00:00 2001 From: austinried <4966622+austinried@users.noreply.github.com> Date: Thu, 8 Oct 2026 13:36:44 +0000 Subject: [PATCH] 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. --- AGENTS.md | 2 +- .../kotlin/com/subtracks/ui/DemoScreenshotTest.kt | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/AGENTS.md b/AGENTS.md index 841a008c..8eba6709 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -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. diff --git a/app/src/test/kotlin/com/subtracks/ui/DemoScreenshotTest.kt b/app/src/test/kotlin/com/subtracks/ui/DemoScreenshotTest.kt index d8d6414a..4db39e20 100644 --- a/app/src/test/kotlin/com/subtracks/ui/DemoScreenshotTest.kt +++ b/app/src/test/kotlin/com/subtracks/ui/DemoScreenshotTest.kt @@ -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