Retire reorder result after a subsequent spacing transaction
This commit is contained in:
@@ -4,7 +4,7 @@ use crate::behavior::scenario_layout::Representation;
|
||||
use crate::diagram_usage::Target;
|
||||
use oa_core::{Diagram, DiagramLayout, Layer, OccurrenceBody, ProjectionKind, ScenarioLayout};
|
||||
|
||||
fn committed() -> (App, Id, Id, oa_core::SourceBundle) {
|
||||
fn committed() -> (App, Id, Id, oa_core::source_project::SourceBundle) {
|
||||
let f = direct_tests::fixture();
|
||||
let mut project = f.project;
|
||||
let mut extra = project
|
||||
@@ -180,3 +180,52 @@ fn scenario_reorder_summary_selection_generation_aba_is_not_a_camera_change() {
|
||||
app.scenario_reorder_reconcile();
|
||||
assert!(app.scenario_reorder.summary.is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn scenario_reorder_summary_clears_after_real_spacing_commit_without_another_event() {
|
||||
use crate::behavior::scenario::spacing::{Event as Spacing, Target as SpacingTarget};
|
||||
let (mut app, owner, call, _) = committed();
|
||||
let reordered = app.document.snapshot();
|
||||
let selection = app.multiselect_snapshot().unwrap();
|
||||
let begin =
|
||||
crate::app::scenario_spacing::tests::packet_for_app(&app, SpacingTarget::Message(call));
|
||||
let Spacing::Begin { press_screen, .. } = begin else {
|
||||
unreachable!()
|
||||
};
|
||||
let _ = app.update(Message::ScenarioCanvas(CanvasEvent::Spacing(begin)));
|
||||
assert_eq!(app.behavior.scenario.spacing_token(), Some(begin.token()));
|
||||
assert!(app.scenario_reorder.summary.is_some());
|
||||
let screen = press_screen + iced::Vector::new(0., 24.);
|
||||
let _ = app.update(Message::ScenarioCanvas(CanvasEvent::Spacing(
|
||||
Spacing::Move {
|
||||
stamp: begin.stamp(),
|
||||
token: begin.token(),
|
||||
screen,
|
||||
},
|
||||
)));
|
||||
assert_eq!(app.document.bundle(), &reordered.bundle);
|
||||
let finish = Spacing::Finish {
|
||||
stamp: begin.stamp(),
|
||||
token: begin.token(),
|
||||
screen,
|
||||
};
|
||||
let _ = app.update(Message::ScenarioCanvas(CanvasEvent::Spacing(finish)));
|
||||
assert_ne!(
|
||||
app.document.bundle(),
|
||||
&reordered.bundle,
|
||||
"spacing must actually commit: {}",
|
||||
app.status
|
||||
);
|
||||
assert_eq!(
|
||||
app.project().elements[&owner].steps(),
|
||||
reordered.decoded.project.elements[&owner].steps()
|
||||
);
|
||||
assert_eq!(
|
||||
app.multiselect_snapshot().unwrap().targets(),
|
||||
selection.targets()
|
||||
);
|
||||
assert!(app.scenario_reorder.summary.is_none());
|
||||
assert!(app.scenario_reorder.summary_selection.is_none());
|
||||
let _ = app.update(Message::Undo);
|
||||
assert_eq!(app.document.bundle(), &reordered.bundle);
|
||||
}
|
||||
|
||||
@@ -165,6 +165,7 @@ impl App {
|
||||
Err(error) => self.status = refusal_reason(&error),
|
||||
}
|
||||
self.reconcile_multiselect();
|
||||
self.scenario_reorder_reconcile();
|
||||
}
|
||||
Event::Cancel { .. } => unreachable!(),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user