Compare commits

...
+7 -11
View File
@@ -10,7 +10,9 @@ async function expectOpaqueWhiteBackground(relativePath) {
const { data, width, height } = image.bitmap;
for (let offset = 3; offset < data.length; offset += 4) {
expect(data[offset], `${relativePath} contains transparent pixels`).toBe(255);
if (data[offset] !== 255) {
throw new Error(`${relativePath} contains transparent pixels at byte offset ${offset}`);
}
}
for (const [x, y] of [
@@ -30,26 +32,20 @@ async function expectOpaqueWhiteBackground(relativePath) {
describe("mobile app icon backgrounds", () => {
it("uses an opaque white background for the iOS marketing icon", async () => {
await expectOpaqueWhiteBackground(
"ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-1024.png",
);
await expectOpaqueWhiteBackground("ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-1024.png");
});
it("uses an opaque white background for Android store and launcher icons", async () => {
await expectOpaqueWhiteBackground("store_icon.png");
for (const density of ["mdpi", "hdpi", "xhdpi", "xxhdpi", "xxxhdpi"]) {
await expectOpaqueWhiteBackground(
`android/app/src/main/res/mipmap-${density}/ic_launcher.png`,
);
await expectOpaqueWhiteBackground(
`android/app/src/main/res/mipmap-${density}/ic_launcher_round.png`,
);
await expectOpaqueWhiteBackground(`android/app/src/main/res/mipmap-${density}/ic_launcher.png`);
await expectOpaqueWhiteBackground(`android/app/src/main/res/mipmap-${density}/ic_launcher_round.png`);
}
const adaptiveBackground = await readFile(
join(root, "android/app/src/main/res/values/ic_launcher_background.xml"),
"utf8",
"utf8"
);
expect(adaptiveBackground).toContain("#FFFFFF");
});