mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-03 06:31:42 +01:00
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 <[email protected]>
This commit is contained in:
1 parent
2d9212622e
commit
629a97bc06
4 files changed
+10
-13
No files matched your search
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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()];
|
||||
|
||||
@@ -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));
|
||||
|
||||
Reference in new issue
Block a user