Skip to content

Commit 8250548

Browse files
committed
fix(web): regenerate favicon assets from svg
1 parent f7b78ce commit 8250548

3 files changed

Lines changed: 41 additions & 0 deletions

File tree

packages/web/public/favicon.ico

-1.77 KB
Binary file not shown.

packages/web/public/favicon.png

-240 Bytes
Loading

packages/web/src/favicon.test.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,54 @@
11
// @vitest-environment node
22

3+
import { execFileSync } from "node:child_process";
34
import { readFileSync } from "node:fs";
45
import { describe, expect, it } from "vitest";
56

7+
function readRgbaPixel(filePath: URL, x: number, y: number) {
8+
const output = execFileSync(
9+
"ffmpeg",
10+
[
11+
"-v",
12+
"error",
13+
"-i",
14+
filePath,
15+
"-vf",
16+
`crop=1:1:${x}:${y}`,
17+
"-f",
18+
"rawvideo",
19+
"-pix_fmt",
20+
"rgba",
21+
"-",
22+
],
23+
{
24+
encoding: "buffer",
25+
}
26+
);
27+
28+
return [...output];
29+
}
30+
631
describe("web favicon wiring", () => {
732
it("references the root favicon.ico asset from index.html", () => {
833
const indexHtml = readFileSync(new URL("../index.html", import.meta.url), "utf8");
934

1035
expect(indexHtml).toContain('href="/favicon.ico"');
1136
expect(indexHtml).not.toContain("/vite.svg");
1237
});
38+
39+
it("keeps the exported favicon PNG transparent at the corners", () => {
40+
const pngPath = new URL("../public/favicon.png", import.meta.url);
41+
const size = 1024;
42+
43+
const corners = [
44+
[0, 0],
45+
[size - 1, 0],
46+
[0, size - 1],
47+
[size - 1, size - 1],
48+
] as const;
49+
50+
for (const [x, y] of corners) {
51+
expect(readRgbaPixel(pngPath, x, y)).toEqual([0, 0, 0, 0]);
52+
}
53+
});
1354
});

0 commit comments

Comments
 (0)