mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-08-11 01:03:51 +08:00
- 校验原生窗口状态与 WebView2 surface 覆盖率 - 在窗口线程刷新 WebView2 bounds,并为异步窗口命令增加状态屏障 - 完善工作区兜底和多显示器坐标转换 - 补充启动最大化、状态轮询及跨平台回归测试 Fixes #824
60 lines
1.9 KiB
TypeScript
60 lines
1.9 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
|
|
import { resolveWailsWindowSetPosition, resolveWailsWindowVisibleViewport } from './wailsWindowViewport';
|
|
|
|
describe('wailsWindowViewport', () => {
|
|
it('keeps browser work-area offsets for platforms that use absolute screen coordinates', () => {
|
|
expect(resolveWailsWindowVisibleViewport(
|
|
{ availWidth: 1728, availHeight: 1040, availLeft: -1728, availTop: 40 },
|
|
{ innerWidth: 1440, innerHeight: 900 },
|
|
)).toEqual({
|
|
availWidth: 1728,
|
|
availHeight: 1040,
|
|
availLeft: -1728,
|
|
availTop: 40,
|
|
});
|
|
});
|
|
|
|
it('uses current-monitor local origin for macOS Wails window positioning', () => {
|
|
expect(resolveWailsWindowVisibleViewport(
|
|
{ availWidth: 1728, availHeight: 1040, availLeft: -1728, availTop: 40 },
|
|
{ innerWidth: 1440, innerHeight: 900 },
|
|
{ useMonitorLocalOrigin: true },
|
|
)).toEqual({
|
|
availWidth: 1728,
|
|
availHeight: 1040,
|
|
availLeft: 0,
|
|
availTop: 0,
|
|
});
|
|
});
|
|
|
|
it('falls back to window inner size when screen size is unavailable', () => {
|
|
expect(resolveWailsWindowVisibleViewport(
|
|
null,
|
|
{ innerWidth: 1280, innerHeight: 720 },
|
|
{ useMonitorLocalOrigin: true },
|
|
)).toEqual({
|
|
availWidth: 1280,
|
|
availHeight: 720,
|
|
availLeft: 0,
|
|
availTop: 0,
|
|
});
|
|
});
|
|
|
|
it('converts negative secondary-monitor coordinates to Wails monitor-local input', () => {
|
|
expect(resolveWailsWindowSetPosition(
|
|
{ x: -1600, y: 80 },
|
|
{ availWidth: 1728, availHeight: 1040, availLeft: -1728, availTop: 40 },
|
|
{ useMonitorLocalOrigin: true },
|
|
)).toEqual({ x: 128, y: 40 });
|
|
});
|
|
|
|
it('maps an offset work-area origin to local zero without double-applying it', () => {
|
|
expect(resolveWailsWindowSetPosition(
|
|
{ x: 1920, y: 40 },
|
|
{ availWidth: 1600, availHeight: 900, availLeft: 1920, availTop: 40 },
|
|
{ useMonitorLocalOrigin: true },
|
|
)).toEqual({ x: 0, y: 0 });
|
|
});
|
|
});
|