Guard that a shipped background can cover something

- Reads each shipped file and requires a format with no alpha channel in it.
  Fails on the overlay scrims that started this, which is the point.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
fkwp
2026-09-18 14:10:26 +02:00
co-authored by Claude Opus 5
parent dfd42e2edd
commit a2fc94a882
+13
View File
@@ -33,6 +33,19 @@ describe("the chosen background effect", () => {
expect(parseEffect("")).toEqual({ kind: "none" });
});
// The regression this guards is not hypothetical: the first stand-ins were
// the app's own overlay gradients, which have no opaque pixel in them at all,
// so as backgrounds their dark half was simply missing.
test("ships only opaque backgrounds", async () => {
const { readFile } = await import("node:fs/promises");
for (const background of shippedBackgrounds) {
const name = background.imagePath.split("/").pop()!.split("?")[0];
const bytes = await readFile(`src/graphics/${name}`);
// JPEG, which has no alpha channel to carry a hole in.
expect([bytes[0], bytes[1], bytes[2]]).toEqual([0xff, 0xd8, 0xff]);
}
});
test("gives every shipped background an image to draw", () => {
for (const background of shippedBackgrounds)
expect(imagePathFor(background.id)).toBeTruthy();