From dc06c4fe44b160232c7dcf62d8d2bd93dad7f094 Mon Sep 17 00:00:00 2001 From: FredApps <153173854+FredApps@users.noreply.github.com> Date: Tue, 1 Dec 2026 12:27:49 +0100 Subject: [PATCH] Backport the validated macOS control harness for drag and translated dialogs (cherry picked from commit 8d9158c35c4a910b9e051fe9430f5194c4654d09) --- crates/ui-egui/tests/it/control.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/crates/ui-egui/tests/it/control.rs b/crates/ui-egui/tests/it/control.rs index 3e68e4a8ca..44be13b881 100644 --- a/crates/ui-egui/tests/it/control.rs +++ b/crates/ui-egui/tests/it/control.rs @@ -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").