Skip to content

PhotoCraft: An open-source, photo editor written by scratch in pure Rust

Tests: allow-list language-invariant bit-depth labels, add missing tr/hu 'Enable animations' (#4359) (#4362)

Valentin Klein5dac5c6d6196
diff --git a/crates/ui-egui/src/new_doc_ui.rs b/crates/ui-egui/src/new_doc_ui.rs
index e3f00c6c9..4af475508 100644
--- a/crates/ui-egui/src/new_doc_ui.rs
+++ b/crates/ui-egui/src/new_doc_ui.rs
@@ -774,9 +774,16 @@ mod tests {
#[test]
fn new_document_depth_labels_and_tooltips_are_translated() {
+ // Bit-depth labels are unit/number strings that some languages legitimately write exactly
+ // like the English source (Turkish "8 bit"); they only need a catalog entry there.
+ const SAME_AS_SOURCE: &[(&str, &str)] = &[("tr", "8 bit"), ("tr", "16 bit")];
for lang in crate::i18n::Lang::all().filter(|lang| lang.code() != "en") {
for (_, label, tooltip) in DEPTH_OPTIONS {
- assert_ne!(crate::i18n::tr(lang, label), *label, "{}: {label}", lang.code());
+ if SAME_AS_SOURCE.contains(&(lang.code(), *label)) {
+ assert!(crate::i18n::has(lang, label), "{}: {label}", lang.code());
+ } else {
+ assert_ne!(crate::i18n::tr(lang, label), *label, "{}: {label}", lang.code());
+ }
assert_ne!(crate::i18n::tr(lang, tooltip), *tooltip, "{}: {tooltip}", lang.code());
}
}