mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-12-03 15:21:17 -05:00
Tests a-m: the halftone test sets its field through the control channel, the old shortcut set name loads as preferences are sanitized
This commit is contained in:
@@ -23,7 +23,10 @@ fn the_halftone_menu_item_opens_a_previewing_dialog() {
|
||||
dialogs::host::pump(&mut app, &ctx);
|
||||
assert!(app.session.in_interaction(), "the preview runs");
|
||||
assert!(app.session.active().unwrap().doc.node(id).is_none(), "the preview shows the halftone in place of the art");
|
||||
app.run("ui.dialog.set", json!({"dialog": dialogs::halftone::CMD, "field": "mode", "value": "cmyk"})).unwrap();
|
||||
// A control channel method, not an engine command.
|
||||
let (req, _) = craft::automation::ControlRequest::new("ui.dialog.set", json!({"field": "mode", "value": "cmyk"}));
|
||||
let craft::automation::Reply::Done(r) = crate::control::handle(&mut app, &ctx, &req) else { panic!("ui.dialog.set answers at once") };
|
||||
assert_eq!(r["ok"], true, "{r}");
|
||||
dialogs::host::pump(&mut app, &ctx);
|
||||
let undo = app.session.doc().unwrap().history.undo.len();
|
||||
host.with(|h| h.confirm_by_id(&ctx, dialog));
|
||||
|
||||
@@ -359,7 +359,8 @@ fn shortcut_set_old_name_is_accepted() {
|
||||
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();
|
||||
// A loaded file's old keys become the sets as the settings are sanitized.
|
||||
let ui = serde_json::from_value::<crate::state::UiState>(json!({ "shortcut_set": old })).unwrap().sanitized();
|
||||
assert_eq!(ui.shortcut_sets.active_name(&BUILTINS), "Classic Defaults");
|
||||
let saved = serde_json::to_value(&ui).unwrap();
|
||||
assert_eq!(saved["shortcut_sets"]["active"], "Classic Defaults");
|
||||
|
||||
Reference in New Issue
Block a user