From a2fc94a882a8533d7fadebdf426b44cec14afbb0 Mon Sep 17 00:00:00 2001 From: fkwp Date: Fri, 18 Sep 2026 14:10:26 +0200 Subject: [PATCH] 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) --- src/livekit/backgroundEffects.test.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/livekit/backgroundEffects.test.ts b/src/livekit/backgroundEffects.test.ts index dc81727c4..6ad7de07c 100644 --- a/src/livekit/backgroundEffects.test.ts +++ b/src/livekit/backgroundEffects.test.ts @@ -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();