test(cua): keep native fixture windows outside Stage Manager sets

This commit is contained in:
creatixchu committed 2026-09-24 11:26:13 +08:00
1 parent c17f008c00
commit c612a97e47
2 files changed
+6

No files matched your search

@@ -43,6 +43,8 @@ final class Fixture: NSObject, NSApplicationDelegate, NSTextFieldDelegate {
window.title = "DSH CUA primary fixture"
window.isReleasedWhenClosed = false
window.animationBehavior = .none
// Keep fixture geometry stable when Stage Manager switches application sets.
window.collectionBehavior = [.canJoinAllApplications, .stationary]
let content = window.contentView!
field = NSTextField(frame: NSRect(x: 30, y: 425, width: 350, height: 28))
field.placeholderString = "Test text"
@@ -79,6 +81,7 @@ final class Fixture: NSObject, NSApplicationDelegate, NSTextFieldDelegate {
second.title = "DSH CUA secondary fixture"
second.isReleasedWhenClosed = false
second.animationBehavior = .none
second.collectionBehavior = [.canJoinAllApplications, .stationary]
let secondary = NSButton(title: "Increment secondary", target: self, action: #selector(incrementSecondary))
secondary.frame = NSRect(x: 30, y: 90, width: 240, height: 32)
second.contentView!.addSubview(secondary)
@@ -96,6 +99,7 @@ final class Fixture: NSObject, NSApplicationDelegate, NSTextFieldDelegate {
@objc func incrementSecondary() { secondaryCount += 1; persist() }
@objc func openFile() {
let panel = NSOpenPanel()
panel.collectionBehavior = [.canJoinAllApplications, .stationary]
panel.directoryURL = URL(fileURLWithPath: statePath).deletingLastPathComponent()
panel.canChooseDirectories = false
panel.allowsMultipleSelection = false
@@ -39,6 +39,8 @@ def check_file_panel(call, owner, primary_params, primary, directory, wait_state
scoped = call("getState", {**primary_params, "windowId": sheet_id})
assert any(e["role"] == "AXSheet" for e in scoped["elements"]), scoped
assert "Increment primary" not in scoped["tree"], scoped
call("activate", owner)
call("getState", {**primary_params, "windowId": sheet_id, "maxElements": 2000})
call("pressKey", {**owner, "key": "g", "modifiers": ["command", "shift"]})
goto = wait_observation(lambda observed: any(e["identifier"] == "PathTextField" for e in observed["elements"]),
"Command+Shift+G did not reach the system panel")