From 879295dd1a3dc4c55cee002a161321bb03002ed2 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Sun, 4 Oct 2026 11:56:39 +0700 Subject: [PATCH] M4.10: shortcut-set alias test reads the legacy name from the alias table Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/shortcut_editor.rs | 2 +- crates/ui-egui/src/tests_labels.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/ui-egui/src/shortcut_editor.rs b/crates/ui-egui/src/shortcut_editor.rs index e55e388f..e145c7de 100644 --- a/crates/ui-egui/src/shortcut_editor.rs +++ b/crates/ui-egui/src/shortcut_editor.rs @@ -20,7 +20,7 @@ use crate::{VectorcraftApp, menus, widgets}; pub const PRESETS: &[&str] = &["VectorCraft Defaults", "Classic Defaults"]; pub const CUSTOM: &str = "Custom"; /// Set names earlier versions saved: (old name, current name). -const LEGACY_PRESETS: &[(&str, &str)] = &[("Illustrator Defaults", "Classic Defaults")]; // brand-ok: legacy preference value +pub const LEGACY_PRESETS: &[(&str, &str)] = &[("Illustrator Defaults", "Classic Defaults")]; // brand-ok: legacy preference value /// The current name of a shortcut set: names earlier versions saved map to today's. pub fn set_name(name: &str) -> &str { diff --git a/crates/ui-egui/src/tests_labels.rs b/crates/ui-egui/src/tests_labels.rs index b67fc18b..f17a0d6a 100644 --- a/crates/ui-egui/src/tests_labels.rs +++ b/crates/ui-egui/src/tests_labels.rs @@ -84,10 +84,10 @@ fn clipboard_preferences_name_the_legacy_format_neutrally() { #[test] fn shortcut_set_old_name_is_accepted() { use crate::shortcut_editor::{PRESETS, import_json}; - const OLD: &str = "Illustrator Defaults"; // brand-ok: legacy preference value under test + let (old, _) = crate::shortcut_editor::LEGACY_PRESETS[0]; assert_eq!(PRESETS, ["VectorCraft Defaults", "Classic Defaults"]); // UI preferences saved by an earlier version load (and save again) under the current name. - let ui: crate::state::UiState = serde_json::from_value(json!({ "shortcut_set": OLD })).unwrap(); + let ui: crate::state::UiState = serde_json::from_value(json!({ "shortcut_set": old })).unwrap(); assert_eq!(ui.shortcut_set, "Classic Defaults"); let saved = serde_json::to_value(&ui).unwrap(); assert_eq!(saved["shortcut_set"], "Classic Defaults"); @@ -97,11 +97,11 @@ fn shortcut_set_old_name_is_accepted() { assert_eq!(default.shortcut_set, PRESETS[0]); // The command and imported sets take the old name too. let mut app = app(); - app.run("shortcuts.preset", json!({ "name": OLD })).unwrap(); + app.run("shortcuts.preset", json!({ "name": old })).unwrap(); assert_eq!(app.ui.shortcut_set, "Classic Defaults"); app.run("shortcuts.preset", json!({ "name": "VectorCraft Defaults" })).unwrap(); assert_eq!(app.ui.shortcut_set, "VectorCraft Defaults"); assert!(app.run("shortcuts.preset", json!({ "name": "Nope" })).is_err()); - let (set, _) = import_json(&json!({ "set": OLD, "overrides": {} })).unwrap(); + let (set, _) = import_json(&json!({ "set": old, "overrides": {} })).unwrap(); assert_eq!(set, "Classic Defaults"); }