Update group removal menu and redo regression fixtures
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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 });
|
||||
|
||||
@@ -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(),
|
||||
&[
|
||||
|
||||
Reference in New Issue
Block a user