PhotoCraft: An open-source, photo editor written by scratch in pure Rust
fix: open Image command dialogs before applying (#1596)
McClabe7c150114104e
diff --git a/crates/ui-egui/src/view_cmds.rs b/crates/ui-egui/src/view_cmds.rsindex ef7c3683e..4856414bd 100644--- a/crates/ui-egui/src/view_cmds.rs+++ b/crates/ui-egui/src/view_cmds.rs@@ -444,6 +444,8 @@ fn wraps(id: &str) -> bool {| "view.newGuideLayout"| "type.warpText"| "type.pasteLoremIpsum"+ | "image.applyImage"+ | "image.calculations")}diff --git a/crates/ui-egui/src/view_cmds/tests.rs b/crates/ui-egui/src/view_cmds/tests.rsindex f5519b806..21c01fcdc 100644--- a/crates/ui-egui/src/view_cmds/tests.rs+++ b/crates/ui-egui/src/view_cmds/tests.rs@@ -173,6 +173,18 @@ fn engine_commands_open_their_dialogs() {assert!(app.ui.views.is_empty() && app.session.documents().is_empty());}+#[test]+fn apply_image_and_calculations_open_dialogs_without_editing() {+ for id in ["image.applyImage", "image.calculations"] {+ let (mut app, ctx) = app_with(1);+ let revision = app.session.active().unwrap().revision;+ let dialog = menu(&mut app, &ctx, id, json!({})).unwrap()["dialog"].as_u64().unwrap_or_else(|| panic!("{id} did not open a dialog"));+ let fields = &app.ui.dialog_mut(dialog).unwrap().fields;+ assert_eq!(fields["__command"], id, "{id} opened the wrong dialog");+ assert_eq!(app.session.active().unwrap().revision, revision, "{id} edited before confirmation");+ }+}+#[test]fn new_guide_layout_remembers_successful_values_not_cancelled_edits() {let (mut app, ctx) = app_with(1);