chore: draw the toolbar icons in-tree with make icons (closes #378)
script/lib/icons.js draws the mark from geometry read back out of the committed PNGs, since the coordinates were never recorded, and writes each PNG with node's own zlib; `make icons` runs it. tests/icons.test.js compares what it draws with icons/ byte for byte. That test is red on purpose. Every pixel matches at all four sizes, but node 22's bundled zlib compresses at level 9 differently from the stock zlib 1.3.1 that made the committed files, so the IDAT bytes differ. How to settle that is the owner's call, asked on the issue. TODO.md is updated with the landing commit. build.js copies the manifests from MANIFEST_SOURCES instead of naming the two paths a second time. Model: opus-5-5
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
// The toolbar icons in icons/ are drawn by script/lib/icons.js (`make icons`).
|
||||
// Each committed file must be exactly what it draws, byte for byte, so the
|
||||
// drawing and the files cannot drift apart: change the drawing, then run
|
||||
// `make icons` and commit the files with it.
|
||||
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
const { icons } = require("../manifest/chrome.json");
|
||||
const { drawIcon } = require("../script/lib/icons");
|
||||
|
||||
describe("toolbar icons", () => {
|
||||
test.each(Object.entries(icons))(
|
||||
"the %spx icon %s is what script/lib/icons.js draws",
|
||||
(size, file) => {
|
||||
const committed = fs.readFileSync(path.join(__dirname, "..", file));
|
||||
expect(drawIcon(Number(size))).toEqual(committed);
|
||||
},
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user