From 629a97bc06c846335525ed11d476f5b8d50be77c Mon Sep 17 00:00:00 2001 From: Martin Ball Date: Sun, 8 Nov 2026 22:43:24 +0000 Subject: [PATCH] test(i18n): run the English half of four catalog-guarded tests The guard skipped catalog-independent checks too; they now run in every build and only the translated language waits for the catalogs. The Arabic layout test reads no catalog and runs unguarded, as on main. Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/dialogs/discard_ui/tests.rs | 4 ++-- crates/ui-egui/src/i18n/live_tests.rs | 3 --- crates/ui-egui/src/notices.rs | 7 +++---- crates/ui-egui/src/panels/layer_menu_ui/tests.rs | 9 +++++---- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/crates/ui-egui/src/dialogs/discard_ui/tests.rs b/crates/ui-egui/src/dialogs/discard_ui/tests.rs index 8c6e7a24bfc..45558cf306f 100644 --- a/crates/ui-egui/src/dialogs/discard_ui/tests.rs +++ b/crates/ui-egui/src/dialogs/discard_ui/tests.rs @@ -369,11 +369,11 @@ fn macos_hides_mnemonics_but_other_platforms_keep_them() { /// "Ja (Y)" with "(N)ein" (#5564). #[test] fn one_dialog_shows_every_key_in_the_same_style() { + let buttons = [("Yes", Some(Key::Y)), ("No", Some(Key::N)), ("Cancel", Some(Key::C))]; + assert_eq!(button_labels(false, &buttons), ["(Y)es", "(N)o", "(C)ancel"]); if !crate::i18n::needs_catalogs() { return; } - let buttons = [("Yes", Some(Key::Y)), ("No", Some(Key::N)), ("Cancel", Some(Key::C))]; - assert_eq!(button_labels(false, &buttons), ["(Y)es", "(N)o", "(C)ancel"]); let german = crate::i18n::Lang::from_code("de").unwrap(); crate::i18n::with_language(german, || { let shown: Vec<&str> = buttons.iter().map(|(label, _)| crate::i18n::tr(german, label)).collect(); diff --git a/crates/ui-egui/src/i18n/live_tests.rs b/crates/ui-egui/src/i18n/live_tests.rs index 2134f731f46..9d87c83607c 100644 --- a/crates/ui-egui/src/i18n/live_tests.rs +++ b/crates/ui-egui/src/i18n/live_tests.rs @@ -638,9 +638,6 @@ fn arabic_labels_are_laid_out_right_to_left() { /// right-to-left document name. #[test] fn arabic_names_are_laid_out_right_to_left() { - if !needs_catalogs() { - return; - } with_language(Lang::EN, || { let h = harness(); let font = egui::FontId::proportional(13.0); diff --git a/crates/ui-egui/src/notices.rs b/crates/ui-egui/src/notices.rs index 6fea4b582b5..ee48c350760 100644 --- a/crates/ui-egui/src/notices.rs +++ b/crates/ui-egui/src/notices.rs @@ -378,11 +378,10 @@ mod tests { #[test] fn import_warning_punctuation_is_localized_without_changing_english() { - if !crate::i18n::needs_catalogs() { - return; - } let mut app = PhotocraftApp::new(Session::new(), Services::default()); - for lang in [crate::i18n::Lang::EN, crate::i18n::Lang::from_code("cs").unwrap()] { + // English in every build; Czech too when the craft-i18n catalogs are embedded. + let czech = crate::i18n::needs_catalogs().then(|| crate::i18n::Lang::from_code("cs").expect("cs registered")); + for lang in std::iter::once(crate::i18n::Lang::EN).chain(czech) { crate::i18n::with_language(lang, || { let what = crate::i18n::fmt(tl!("Opened {name}"), &[("name", "x.psd")]); let warnings = vec!["first warning".into(), "second warning".into(), "third warning".into()]; diff --git a/crates/ui-egui/src/panels/layer_menu_ui/tests.rs b/crates/ui-egui/src/panels/layer_menu_ui/tests.rs index e650a2e7176..4a5694d5705 100644 --- a/crates/ui-egui/src/panels/layer_menu_ui/tests.rs +++ b/crates/ui-egui/src/panels/layer_menu_ui/tests.rs @@ -2,9 +2,10 @@ use super::*; #[test] fn mask_toggle_label_follows_history_and_selected_layer() { - if !crate::i18n::needs_catalogs() { - return; - } + // English in every build; French too when the craft-i18n catalogs are embedded. + let langs: Vec<_> = std::iter::once(crate::i18n::Lang::EN) + .chain(crate::i18n::needs_catalogs().then(|| crate::i18n::Lang::from_code("fr").expect("fr registered"))) + .collect(); let mut s = photocraft_engine::Session::new(); s.execute("file.new", json!({"width": 10, "height": 10})).unwrap(); s.execute("layer.new.layer", json!({})).unwrap(); @@ -20,7 +21,7 @@ fn mask_toggle_label_follows_history_and_selected_layer() { let item = crate::menus::menu_items(app).into_iter().find(|i| i.id == toggle).unwrap(); assert_eq!(item.enabled, label.is_some()); assert_eq!(item.label, label.unwrap_or("Enable Layer Mask")); - for lang in [crate::i18n::Lang::EN, crate::i18n::Lang::from_pref("fr")] { + for &lang in &langs { let layout = crate::native_menu::photocraft_layout(&crate::menus::menu_items(app), lang, lang.code()); let native = layout.bar.find(toggle).unwrap(); assert_eq!(native.label, crate::i18n::tr(lang, &item.label));