Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions scripts/desktop-tauri-build.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,31 @@ test('Desktop DMG uses the branded installer layout', () => {
appPosition: { x: 180, y: 170 },
applicationFolderPosition: { x: 480, y: 170 },
});

// Finder uses the PNG's physical size, not just its pixel dimensions.
// A 660x400 image tagged at 96 DPI renders at 495x300 points and leaves gaps.
const dmg = config.bundle.macOS.dmg;
const background = readFileSync(join(ROOT, 'src', 'apps', 'desktop', dmg.background));
assert.deepEqual(background.subarray(0, 8), Buffer.from('89504e470d0a1a0a', 'hex'));
let pixels;
let density;
for (let offset = 8; offset < background.length; ) {
const length = background.readUInt32BE(offset);
const type = background.toString('ascii', offset + 4, offset + 8);
if (type === 'IHDR') {
pixels = [background.readUInt32BE(offset + 8), background.readUInt32BE(offset + 12)];
} else if (type === 'pHYs') {
assert.equal(background[offset + 16], 1, 'background density must be in pixels per metre');
density = [background.readUInt32BE(offset + 8), background.readUInt32BE(offset + 12)];
}
offset += length + 12;
}
assert.ok(pixels && density, 'DMG background must declare pixel dimensions and physical density');
for (const [axis, points] of [dmg.windowSize.width, dmg.windowSize.height].entries()) {
const imagePoints = pixels[axis] * 72 / (density[axis] * 0.0254);
// PNG stores integer pixels/metre, so 72 DPI rounds to 2835 pixels/metre.
assert.ok(Math.abs(imagePoints - points) < 0.1, `background axis ${axis} must match Finder points`);
}
});

test('Desktop builds prepare and bundle the OpenCode extension Host', () => {
Expand Down
Binary file modified src/apps/desktop/dmg/background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading