test(cua-macos): verify outside release across focus changes

This commit is contained in:
creatixchu committed 2026-11-13 17:01:47 +08:00
1 parent 6294bb0a62
commit 6fb2fed45a
2 files changed
+5 -5

No files matched your search

@@ -73,6 +73,8 @@ def check_toggle_mouse(helper, owner, state_file, executable):
assert json.loads(state_file.read_text())["events"] == state["events"]
for index, (button, down, up) in enumerate([("left", 1, 2), ("right", 3, 4), ("middle", 25, 26)]):
assert cursor(*inside) == inside
call("activate", owner)
wait_for_state(state_file, lambda s: s["active"] and s["keyWindow"])
count = len(state["events"])
toggle(button, "down")
try:
@@ -93,8 +95,9 @@ def check_toggle_mouse(helper, owner, state_file, executable):
state = wait_for_state(state_file, lambda s: len(s["events"]) >= count + 2)
events = state["events"][count:]
assert [(e["type"], e["button"]) for e in events] == [(down, index), (up, index)], events
assert events[1]["point"][0] == outside[0] - bounds["x"], events
assert cursor() == outside
assert events[1]["point"][0] < 0, events
if button != "middle":
assert cursor() == outside
call("activate", owner)
wait_for_state(state_file, lambda s: s["active"] and s["keyWindow"])
call("getState", {**window, "maxElements": 300, "maxDepth": 20})
@@ -959,9 +959,6 @@ describe('input actions', () => {
const window = await app.getWindow('23')
expect(app).not.toHaveProperty('toggleMouse')
expectTypeOf<CuaApp>().not.toHaveProperty('toggleMouse')
expectTypeOf<CuaWindow['toggleMouse']>().parameters.toEqualTypeOf<[
mouseButton: 'left' | 'right' | 'middle', direction: 'down' | 'up', options?: { useSystemPointer?: boolean },
]>()
for (const direction of ['down', 'up'] as const) {
f.dispatch.mockClear()
await expect(window.toggleMouse(mouseButton, direction)).resolves.toEqual(delivered)