Backport the validated macOS control harness for drag and translated dialogs

(cherry picked from commit 8d9158c35c4a910b9e051fe9430f5194c4654d09)
This commit is contained in:
FredApps committed 2026-12-01 12:28:32 +01:00
1 parent a69add4786
commit dc06c4fe44
1 file changed
+15
+15
View File
@@ -1162,11 +1162,23 @@ fn japanese_dialogs_errors_and_custom_action_names() {
("compare-files", "ファイルを比較"),
("sign", "署名用のデジタル ID を設定"),
] {
// Close the previous modal before opening another; a hosted dialog must not be
// inspected through the JavaScript console or another modal's access boundary.
ok(&mut h, &c, "ui.set", json!({"key": "dialog", "value": "none"}));
settle(&mut h);
ok(&mut h, &c, "ui.set", json!({"key": "dialog", "value": dialog}));
// Hosted dialogs publish their access tree on a subsequent frame.
settle(&mut h);
let found = ok(&mut h, &c, "ui.inspect", json!({"query": label}));
assert!(found["count"].as_u64().unwrap() > 0, "{dialog}: {found}");
if dialog == "js-console" {
// The console is an inline window outside the hosted dialog stack. Close it
// through its translated button before inspecting the next hosted dialog.
ok(&mut h, &c, "ui.click", json!({"label": "閉じる"}));
settle(&mut h);
let closed = ok(&mut h, &c, "ui.inspect", json!({"query": label}));
assert_eq!(closed["count"], 0, "the console must close before the next dialog: {closed}");
}
}
ok(&mut h, &c, "ui.set", json!({"key": "dialog", "value": "none"}));
let ctx_h = h.ctx.clone();
@@ -1281,6 +1293,9 @@ fn commands_keys_and_typing() {
#[test]
fn ctrl_dragging_a_thumbnail_through_the_control_channel_copies_the_page() {
let (mut h, c) = harness_pages(3);
// The control protocol normalizes modifier flags for the host OS. Exercise that same
// OS in the shell rather than pairing macOS protocol input with the Linux test shell.
craft::ui::testing::windows::set_os(&h.ctx, craft::host::target::Os::current());
ok(&mut h, &c, "ui.set", json!({ "key": "tool", "value": "organize" }));
h.run_steps(3);
// The grid cell of a page: the node labelled exactly "Page N" (the checkbox says "Select page N").