DesignCraft: An open-source page and layout design editor written by scratch in pure Rust
Integration (editor-undo): Story Editor test focuses the text input, not its text run; paste test sets its stale selection after Undo restores the selection
aionggd9c766dd1648
diff --git a/crates/engine/src/cmd/edit.rs b/crates/engine/src/cmd/edit.rsindex 54f00eb43..43e9e4f90 100644--- a/crates/engine/src/cmd/edit.rs+++ b/crates/engine/src/cmd/edit.rs@@ -785,8 +785,8 @@ mod paste_tests {assert_eq!(clip.assets.keys().copied().collect::<Vec<_>>(), [aid]);}- /// Undo leaves the id of the copy it removed in the selection. Copy measures from the spread- /// of the first selected object that is still there.+ /// A selection can name an object that is gone (here the copy that Undo removed). Copy+ /// measures from the spread of the first selected object that is still there.#[test]fn copy_measures_from_the_first_selected_object_that_exists() {let mut s = Session::new();@@ -797,8 +797,8 @@ mod paste_tests {s.execute("edit.copy", &json!({})).unwrap();let gone = s.execute("edit.paste", &json!({"spread": 1})).unwrap()["ids"][0].as_u64().unwrap();s.execute("edit.undo", &json!({})).unwrap();- s.execute("selection.set", &json!({"ids": [a], "add": true})).unwrap();- assert_eq!(s.doc().unwrap().selection.items, [ItemId(gone), ItemId(a)]);+ assert_eq!(s.doc().unwrap().selection.items, [ItemId(a)], "Undo restores the selection from before the paste");+ s.doc_mut().unwrap().selection.items = vec![ItemId(gone), ItemId(a)];s.execute("edit.copy", &json!({})).unwrap();assert_eq!(pasted(&mut s, "edit.pasteInPlace", json!({"spread": 1})), (SpreadRef::Doc(1), Rect::new(w + 36.0, 36.0, w + 136.0, 136.0)));}diff --git a/crates/ui-egui/src/story_editor.rs b/crates/ui-egui/src/story_editor.rsindex 8e2b3eb67..fd7e618b1 100644--- a/crates/ui-egui/src/story_editor.rs+++ b/crates/ui-egui/src/story_editor.rs@@ -138,7 +138,7 @@ mod tests {app.run("file.activate", json!({"index": 0})).unwrap();app.run("app.storyEditor", json!({"story": stories[0]})).unwrap();let mut h = crate::test_window::open(app, egui::vec2(1440.0, 900.0));- h.get_by_value("Alpha story").focus();+ h.get_by(|n| n.role() == egui::accesskit::Role::MultilineTextInput && n.value().as_deref() == Some("Alpha story")).focus();h.run_steps(2);h.event(egui::Event::Text("!".into()));h.run_steps(2);