Skip to content

Commit d210e11

Browse files
committed
test(desktop): check the focus target carries physical window bounds
1 parent b67bb2b commit d210e11

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

‎apps/desktop/src/electron/ElectronWindow.test.ts‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,15 @@ vi.mock("electron", () => ({
5353
getAllWindows: getAllWindowsMock,
5454
getFocusedWindow: getFocusedWindowMock,
5555
}),
56-
screen: { dipToScreenRect: (_window: unknown, rect: unknown) => rect },
56+
screen: {
57+
// A 200% display, so the focus target must carry converted bounds.
58+
dipToScreenRect: (_window: unknown, rect: Electron.Rectangle) => ({
59+
x: rect.x * 2,
60+
y: rect.y * 2,
61+
width: rect.width * 2,
62+
height: rect.height * 2,
63+
}),
64+
},
5765
}));
5866

5967
import * as ElectronWindow from "./ElectronWindow.ts";
@@ -117,6 +125,13 @@ describe("ElectronWindow", () => {
117125
});
118126
const electronWindow = yield* ElectronWindow.ElectronWindow;
119127
yield* electronWindow.prepareReveal(window as unknown as Electron.BrowserWindow);
128+
assert.deepEqual(windowsForegroundPrepareMock.mock.calls[0]?.[0], {
129+
windowId: 41,
130+
processId: process.pid,
131+
title: "T3 Code (Dev)",
132+
bounds: { x: 200, y: 100, width: 2_400, height: 1_600 },
133+
contentBounds: { x: 216, y: 100, width: 2_368, height: 1_584 },
134+
});
120135
window.getTitle.mockClear();
121136

122137
const revealFiber = yield* electronWindow

0 commit comments

Comments
 (0)