From 35be9ae133f3a32434c4d84edcdb0764044b7539 Mon Sep 17 00:00:00 2001 From: "sorokin.oleg.edu" Date: Thu, 24 Sep 2026 18:43:56 -0700 Subject: [PATCH] Update group removal menu and redo regression fixtures --- crates/oa-desktop/src/app.rs | 4 +++- .../src/app/scenario_removal/tests.rs | 19 +++++++++++++++++++ .../src/model_menu_scenario_tests.rs | 16 ++++++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/crates/oa-desktop/src/app.rs b/crates/oa-desktop/src/app.rs index e38d2ad3..6ab7a854 100644 --- a/crates/oa-desktop/src/app.rs +++ b/crates/oa-desktop/src/app.rs @@ -1418,7 +1418,9 @@ impl App { Message::Command(Command::MoveStep(..)) | Message::Delete ) { - self.status = "Group reordering and removal need a whole-selection operation. Select one occurrence to edit it individually.".into(); + self.status = + "Use Reorder or Remove above the canvas to act on the complete Scenario selection." + .into(); return Task::none(); } let preview_read_only = self.process_preview_primary().is_some(); diff --git a/crates/oa-desktop/src/app/scenario_removal/tests.rs b/crates/oa-desktop/src/app/scenario_removal/tests.rs index c542f55a..f8c576c2 100644 --- a/crates/oa-desktop/src/app/scenario_removal/tests.rs +++ b/crates/oa-desktop/src/app/scenario_removal/tests.rs @@ -318,7 +318,26 @@ fn scenario_group_removal_cancel_preserves_existing_redo_and_full_selection() { let renamed = f.app.document.bundle().clone(); let _ = f.app.update(Message::Undo); assert!(f.app.document.can_redo()); + // Rename inspects the renamed tail; Undo preserves that inspection. Restore + // the real group before testing cancellation of its removal review. + for (id, choice) in [ + (f.reply, multiselect::Choice::Replace), + (f.call, multiselect::Choice::Add), + ] { + let event = selection::Event { + context: f.app.scenario_context().unwrap(), + snapshot: f.app.multiselect_snapshot().unwrap(), + intent: selection::Intent::Choose(Target::ScenarioObject(id), choice), + }; + let _ = f + .app + .update(Message::ScenarioCanvas(CanvasEvent::Selection(Box::new( + event, + )))); + } let selected = f.app.multiselect_snapshot().unwrap(); + assert_eq!(selected.targets().len(), 2); + assert!(f.app.document.can_redo()); let source = f.app.document.bundle().clone(); let token = open(&mut f.app); send(&mut f.app, Event::Cancel { token }); diff --git a/crates/oa-desktop/src/model_menu_scenario_tests.rs b/crates/oa-desktop/src/model_menu_scenario_tests.rs index 3a5b6f45..f0a0f647 100644 --- a/crates/oa-desktop/src/model_menu_scenario_tests.rs +++ b/crates/oa-desktop/src/model_menu_scenario_tests.rs @@ -211,6 +211,7 @@ fn scenario_group_menus_capture_set_and_never_expose_partial_model_actions() { .any(|e| matches!(e, Entry::Title(label) if label == "2 selected")) ); let mut enabled = 0; + let mut removals = 0; for entry in menu.entries { match entry { Entry::Action { @@ -218,6 +219,20 @@ fn scenario_group_menus_capture_set_and_never_expose_partial_model_actions() { message: Some(Message::Menu(Event::Invoke(_, message))), .. } => { + if let Message::ScenarioRemoval(event) = &*message { + let crate::app::scenario_removal::Event::Begin { + context, + snapshot: captured, + } = &**event + else { + panic!("Group menu must capture a fresh removal review"); + }; + assert_eq!(label, "Remove selected from Scenario…"); + assert_eq!(Some(*context), app.scenario_context()); + assert_eq!(captured, &snapshot); + removals += 1; + continue; + } let Message::ScenarioCanvas(CanvasEvent::Selection(event)) = *message else { panic!("Scenario group menu exposed a singleton model action"); }; @@ -250,6 +265,7 @@ fn scenario_group_menus_capture_set_and_never_expose_partial_model_actions() { } } assert_eq!(enabled, if target == first { 3 } else { 2 }); + assert_eq!(removals, 1, "One captured whole-selection removal action"); assert_eq!( app.diagram_selection.as_ref().unwrap().targets(), &[