Format saved allocation readability regressions
This commit is contained in:
@@ -1039,19 +1039,31 @@ fn frozen_performer_label_refuses_overlapping_work_header_and_allows_nearby_exac
|
||||
// The actual frozen renderer bounds for Receiver at (100, 100).
|
||||
context.target.as_mut().unwrap().label = Rect {
|
||||
position: xy(110., 131.),
|
||||
size: Size { width: 88., height: 22. },
|
||||
size: Size {
|
||||
width: 88.,
|
||||
height: 22.,
|
||||
},
|
||||
};
|
||||
let label = context.target.unwrap().label;
|
||||
let counterexample = Rect {
|
||||
position: xy(120., 110.),
|
||||
size: Size { width: 224., height: 62. },
|
||||
size: Size {
|
||||
width: 224.,
|
||||
height: 62.,
|
||||
},
|
||||
};
|
||||
assert!(context.viewport.contains(label));
|
||||
assert!(context.viewport.contains(counterexample));
|
||||
assert!(label.contains(Rect {
|
||||
position: xy(134., 145.),
|
||||
size: Size { width: 1., height: 1. },
|
||||
}), "the formerly admitted work name begins underneath the label");
|
||||
assert!(
|
||||
label.contains(Rect {
|
||||
position: xy(134., 145.),
|
||||
size: Size {
|
||||
width: 1.,
|
||||
height: 1.
|
||||
},
|
||||
}),
|
||||
"the formerly admitted work name begins underneath the label"
|
||||
);
|
||||
let before = plan.project().clone();
|
||||
assert!(matches!(
|
||||
place(&plan, xy(120., 105.), context),
|
||||
@@ -1078,7 +1090,10 @@ fn frozen_label_readability_allows_touching_edges_but_refuses_positive_area_over
|
||||
let mut context = presentation(&f.p, f.d, Some(f.a));
|
||||
context.target.as_mut().unwrap().label = Rect {
|
||||
position: xy(110., 131.),
|
||||
size: Size { width: 90., height: 19. },
|
||||
size: Size {
|
||||
width: 90.,
|
||||
height: 19.,
|
||||
},
|
||||
};
|
||||
for (position, allowed) in [
|
||||
(xy(190., 110.), false),
|
||||
@@ -1102,7 +1117,13 @@ fn same_performer_readability_preserves_snapped_noop_and_allocation_identity() {
|
||||
let mut f = fixture(layer);
|
||||
let a = f.a;
|
||||
allocation(&mut f, a);
|
||||
f.p.diagrams.get_mut(&f.d).unwrap().nodes.get_mut(&f.n).unwrap().position = xy(150., 200.);
|
||||
f.p.diagrams
|
||||
.get_mut(&f.d)
|
||||
.unwrap()
|
||||
.nodes
|
||||
.get_mut(&f.n)
|
||||
.unwrap()
|
||||
.position = xy(150., 200.);
|
||||
let plan = semantic(&f, Destination::Performer(f.a));
|
||||
let context = presentation(&f.p, f.d, Some(f.a));
|
||||
assert_eq!(plan.project(), &f.p);
|
||||
|
||||
@@ -967,15 +967,20 @@ fn oa_sa_label_overlap_refuses_preview_release_and_retries_without_partial_sourc
|
||||
project.elements.get_mut(&f.a).unwrap().name = "Receiver".into();
|
||||
replace(&mut f, project);
|
||||
// Refusals must also preserve an existing redo branch.
|
||||
let _ = f.app.update(Message::Command(Command::Rename(f.work, "Temporary".into())));
|
||||
let _ = f.app.update(Message::Command(Command::Rename(
|
||||
f.work,
|
||||
"Temporary".into(),
|
||||
)));
|
||||
let _ = f.app.update(Message::Undo);
|
||||
f.app.zoom = zoom;
|
||||
f.app.pan = pan;
|
||||
f.app.fit_to_view = false;
|
||||
let screen = |world: Position| Point::new(
|
||||
bounds().x + world.x * zoom + pan.x,
|
||||
bounds().y + world.y * zoom + pan.y,
|
||||
);
|
||||
let screen = |world: Position| {
|
||||
Point::new(
|
||||
bounds().x + world.x * zoom + pan.x,
|
||||
bounds().y + world.y * zoom + pan.y,
|
||||
)
|
||||
};
|
||||
let from = screen(xy(140., 535.));
|
||||
let overlap = screen(xy(160., 140.));
|
||||
let clear = screen(xy(160., 190.));
|
||||
@@ -990,7 +995,10 @@ fn oa_sa_label_overlap_refuses_preview_release_and_retries_without_partial_sourc
|
||||
let feedback = f.app.allocation_drag.feedback.as_ref().unwrap();
|
||||
assert!(feedback.refused, "{}", feedback.text);
|
||||
assert!(feedback.text.contains("Aim below or beside"));
|
||||
assert_eq!(feedback.press.frozen.targets[feedback.targets[0]].element, f.a);
|
||||
assert_eq!(
|
||||
feedback.press.frozen.targets[feedback.targets[0]].element,
|
||||
f.a
|
||||
);
|
||||
assert_eq!(f.app.project(), &accepted);
|
||||
assert_eq!(f.app.document.bundle(), &source);
|
||||
assert!(Arc::ptr_eq(&snapshot, &f.app.document.snapshot()));
|
||||
@@ -1014,24 +1022,48 @@ fn oa_sa_label_overlap_refuses_preview_release_and_retries_without_partial_sourc
|
||||
let active = f.app.allocation_drag.active.as_ref().unwrap();
|
||||
let p = active.press.clone();
|
||||
let semantic = active.cache[0].1.as_ref().unwrap().clone();
|
||||
let _ = f.app.update(Message::WorkDrag(Event::Preview(p.stamp, p.token, Some(clear))));
|
||||
let _ = f.app.update(Message::WorkDrag(Event::Preview(
|
||||
p.stamp,
|
||||
p.token,
|
||||
Some(clear),
|
||||
)));
|
||||
let preview = f.app.allocation_drag.preview.as_ref().expect(&f.app.status);
|
||||
assert!(Arc::ptr_eq(&semantic, &preview.semantic));
|
||||
assert_eq!(preview.placement.diagram.nodes[&f.node].position, xy(120., 160.));
|
||||
assert_eq!(preview.placement.view, projection::project_diagram_with_index(
|
||||
semantic.project(), &preview.placement.diagram, semantic.index(),
|
||||
));
|
||||
assert_eq!(
|
||||
preview.placement.diagram.nodes[&f.node].position,
|
||||
xy(120., 160.)
|
||||
);
|
||||
assert_eq!(
|
||||
preview.placement.view,
|
||||
projection::project_diagram_with_index(
|
||||
semantic.project(),
|
||||
&preview.placement.diagram,
|
||||
semantic.index(),
|
||||
)
|
||||
);
|
||||
let mut expected = semantic.project().clone();
|
||||
expected.diagrams.insert(f.diagram, preview.placement.diagram.clone());
|
||||
expected
|
||||
.diagrams
|
||||
.insert(f.diagram, preview.placement.diagram.clone());
|
||||
assert_eq!(f.app.project(), &accepted);
|
||||
assert_eq!(f.app.document.bundle(), &source);
|
||||
let _ = f.app.update(Message::WorkDrag(Event::Release(p.stamp, p.token, Some(clear))));
|
||||
let _ = f.app.update(Message::WorkDrag(Event::Release(
|
||||
p.stamp,
|
||||
p.token,
|
||||
Some(clear),
|
||||
)));
|
||||
assert_eq!(f.app.project(), &expected, "{}", f.app.status);
|
||||
assert_eq!(f.app.document.revision(), revision + 1);
|
||||
assert!(f.app.document.can_undo());
|
||||
assert!(!f.app.document.can_redo());
|
||||
let after = f.app.document.bundle().clone();
|
||||
assert_eq!(oa_core::source_project::compile_bundle(&after, Default::default()).unwrap().decoded.project, expected);
|
||||
assert_eq!(
|
||||
oa_core::source_project::compile_bundle(&after, Default::default())
|
||||
.unwrap()
|
||||
.decoded
|
||||
.project,
|
||||
expected
|
||||
);
|
||||
let _ = f.app.update(Message::Undo);
|
||||
assert_eq!(f.app.project(), &accepted);
|
||||
assert_eq!(f.app.document.bundle(), &source);
|
||||
|
||||
Reference in New Issue
Block a user