mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-02 06:20:48 +01:00
Preferences: RAW Defaults shows proper names (#17770)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
71bc742294
commit
cbaa4dfe19
2 files changed
+41
No files matched your search
@@ -228,6 +228,9 @@ fn label_override(key: &str) -> Option<&'static str> {
|
||||
"lowLatencyDrawing" => "Low-Latency Drawing (vsync off, applies at next launch)",
|
||||
"sizeLimitMb" => "Scratch Size Limit (MB, 0 = No Limit)",
|
||||
"gpuMemoryMb" => "GPU Memory (MB, 0 = Automatic)",
|
||||
"openInCameraRaw" => "Open in RAW Develop",
|
||||
"openAsSmartObject" => "Open as Smart Object",
|
||||
"writeXmpSidecars" => "Write XMP sidecars",
|
||||
_ => return None,
|
||||
})
|
||||
}
|
||||
@@ -252,6 +255,11 @@ pub(super) fn choice_label(v: &str) -> String {
|
||||
"ahd" => "AHD (adaptive homogeneity)".into(),
|
||||
"mhc" => "Malvar–He–Cutler".into(),
|
||||
"cpu" => "CPU (no GPU acceleration)".into(),
|
||||
"displayP3" => "Display P3".into(),
|
||||
"proPhoto" => "ProPhoto RGB".into(),
|
||||
"srgb" => "sRGB IEC61966-2.1".into(),
|
||||
"glossy" => "Glossy Paper".into(),
|
||||
"matte" => "Matte Paper".into(),
|
||||
v => spelled(v),
|
||||
}
|
||||
}
|
||||
@@ -302,3 +310,7 @@ mod language_label_tests {
|
||||
assert!(!rules(&ctx).is_empty());
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[path = "../raw_defaults_labels_tests.rs"]
|
||||
mod raw_defaults_labels_tests;
|
||||
@@ -0,0 +1,29 @@
|
||||
//! Preferences > RAW Defaults shows proper names instead of words spelled out from the stored ids (#17770).
|
||||
|
||||
use craft::i18n::Folder;
|
||||
use craft::i18n::matcher::Matcher;
|
||||
use craft::ui::patterns::preferences::{PreferencesModel, SettingsDocument, row_matches};
|
||||
use photocraft_engine::prefs;
|
||||
|
||||
use super::{PrefPages, choice_label, rules, spelled};
|
||||
|
||||
/// The labels hang on stored ids written as text, so a renamed id would silently fall back to `spelled`.
|
||||
#[test]
|
||||
fn raw_choices_have_names_of_their_own() {
|
||||
for (path, ids) in [("rawDefaults.colorSpace", &["srgb", "proPhoto", "displayP3"][..]), ("rawDefaults.sharpenFor", &["glossy", "matte"][..])] {
|
||||
let offered = prefs::choices(path).expect("a choice setting");
|
||||
for id in ids {
|
||||
assert!(offered.contains(id), "{path} no longer offers {id}");
|
||||
assert_ne!(choice_label(id), spelled(id), "{path}: {id}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn preferences_search_finds_the_raw_develop_switch() {
|
||||
let doc = SettingsDocument::new(PrefPages::default()).expect("the default preferences").rules(rules(&egui::Context::default()));
|
||||
let matcher = Matcher::new(&Folder::new("en"), "RAW Develop");
|
||||
let pages = PreferencesModel::pages(&doc);
|
||||
let found: Vec<&str> = pages.iter().flat_map(|p| &p.groups).flat_map(|g| &g.rows).filter(|r| row_matches(&matcher, r)).map(|r| r.key).collect();
|
||||
assert!(found.contains(&"rawDefaults.openInCameraRaw"), "{found:?}");
|
||||
}
|
||||
Reference in new issue
Block a user