From baaf3061b057aeaf83e7a225bd4e440240c9a006 Mon Sep 17 00:00:00 2001 From: aiongg Date: Mon, 19 Oct 2026 21:40:29 +0000 Subject: [PATCH] keymap: run the pseudo-locale dialog test once per direction, each at one width --- crates/keymap/tests/ui_dialog.rs | 51 ++++++++++++++++---------------- 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/crates/keymap/tests/ui_dialog.rs b/crates/keymap/tests/ui_dialog.rs index 5ddf5800..5f0ee994 100644 --- a/crates/keymap/tests/ui_dialog.rs +++ b/crates/keymap/tests/ui_dialog.rs @@ -870,31 +870,30 @@ fn check_pseudo(h: &Harness<'_, Fx>, width: f32, step: &str) { #[test] fn pseudo_locale_marks_every_string_and_fits() { let p = Pseudo::mark; - for rtl in [false, true] { - for width in [560.0, 1100.0] { - let unlisted = std::rc::Rc::default(); - let mut fx = Fx::new(with_long_label(fixture(Platform::Mac))); - fx.text = Box::new(Pseudo { unlisted: std::rc::Rc::clone(&unlisted), rtl }); - fx.options.keyboard = true; - fx.sets = Some((Profiles::default(), vec![("Fixture Defaults", Overrides::new())])); - let mut h = harness(fx, vec2(width, 720.0)); - let step = |s: &str| format!("{} {width}: {s}", if rtl { "rtl" } else { "ltr" }); - check_pseudo(&h, width, &step("opened")); - h.state_mut().state.select(&CommandRef::from("object.distribute")); - h.run(); - check_pseudo(&h, width, &step("long label selected")); - let export = craft_i18n::fmt(&p("{label}: {chord}"), &[("label", &p("Export…")), ("chord", "⌘E")]); - click(&mut h, &export); - press(&mut h, Modifiers::COMMAND, EguiKey::S); - assert!(has(&h, &p("Take It")), "{}", step("conflict bar")); - check_pseudo(&h, width, &step("conflict")); - click(&mut h, &p("Keep Both")); - check_pseudo(&h, width, &step("kept both")); - click(&mut h, &p("Keyboard")); - check_pseudo(&h, width, &step("keyboard hidden")); - review(&mut h); - check_pseudo(&h, width, &step("review")); - assert!(unlisted.borrow().is_empty(), "looked up but not in STRINGS or PLURALS: {:?}", unlisted.borrow()); - } + // Each direction at one width: the narrow layout left to right, the wide one right to left. + for (rtl, width) in [(false, 560.0), (true, 1100.0)] { + let unlisted = std::rc::Rc::default(); + let mut fx = Fx::new(with_long_label(fixture(Platform::Mac))); + fx.text = Box::new(Pseudo { unlisted: std::rc::Rc::clone(&unlisted), rtl }); + fx.options.keyboard = true; + fx.sets = Some((Profiles::default(), vec![("Fixture Defaults", Overrides::new())])); + let mut h = harness(fx, vec2(width, 720.0)); + let step = |s: &str| format!("{} {width}: {s}", if rtl { "rtl" } else { "ltr" }); + check_pseudo(&h, width, &step("opened")); + h.state_mut().state.select(&CommandRef::from("object.distribute")); + h.run(); + check_pseudo(&h, width, &step("long label selected")); + let export = craft_i18n::fmt(&p("{label}: {chord}"), &[("label", &p("Export…")), ("chord", "⌘E")]); + click(&mut h, &export); + press(&mut h, Modifiers::COMMAND, EguiKey::S); + assert!(has(&h, &p("Take It")), "{}", step("conflict bar")); + check_pseudo(&h, width, &step("conflict")); + click(&mut h, &p("Keep Both")); + check_pseudo(&h, width, &step("kept both")); + click(&mut h, &p("Keyboard")); + check_pseudo(&h, width, &step("keyboard hidden")); + review(&mut h); + check_pseudo(&h, width, &step("review")); + assert!(unlisted.borrow().is_empty(), "looked up but not in STRINGS or PLURALS: {:?}", unlisted.borrow()); } }