Combine source navigation and alias rename with canvas ownership guards

This commit is contained in:
2026-09-12 19:49:26 -07:00
parent 95e0e12716
commit a17ca5d066
72 changed files with 21764 additions and 189 deletions
+30 -3
View File
@@ -377,7 +377,8 @@ fn source_navigation_waits_for_editor_layout_and_cancels_on_edit() {
send(&mut app, Message::SourceForSelection);
assert_eq!(app.page, Page::Text);
assert!(app.source_jump.is_some());
send(&mut app, Message::SourceViewport);
let ticket = app.source_reveal_ticket();
send(&mut app, Message::SourceViewport(ticket));
assert!(app.source_jump.is_none());
send(&mut app, Message::SourceForSelection);
assert!(app.source_jump.is_some());
@@ -409,7 +410,8 @@ fn source_find_navigates_an_invalid_draft_without_applying_or_losing_it() {
cursor.selection,
Some(text_editor::Position { line: 0, column: 9 })
);
send(&mut app, Message::SourceViewport);
let ticket = app.source_reveal_ticket();
send(&mut app, Message::SourceViewport(ticket));
assert_eq!(app.source_editor.cursor(), cursor);
send(
&mut app,
@@ -1269,7 +1271,26 @@ fn revealing_an_implicit_function_port_unfolds_its_visible_architecture_owner()
.get_mut(&ancestor)
.unwrap()
.collapsed = true;
assert!(crate::navigation::diagrams_containing(&p, port).contains(&diagram));
// The usage query reports rendered objects; this port's owner is folded.
// The legacy authoring reveal below explicitly expands its saved ancestor.
assert!(
!oa_core::projection::project_view(&p, diagram)
.ports
.iter()
.any(|shown| shown.element == port)
);
assert!(crate::diagram_usage::saved_usages_for(&p, port, Some(diagram)).is_empty());
// Other saved views of this function may still paint the port.
let elsewhere = crate::diagram_usage::saved_usages(&p, port);
assert!(
!elsewhere.is_empty(),
"the demo still paints this port in another saved view"
);
assert!(
elsewhere
.iter()
.all(|usage| usage.surface != crate::diagram_usage::Surface::Saved(diagram))
);
let mut app = App::with_project(p);
send(&mut app, Message::RevealInDiagram(diagram, port));
assert_eq!(app.selected, port);
@@ -1281,6 +1302,12 @@ fn revealing_an_implicit_function_port_unfolds_its_visible_architecture_owner()
.iter()
.any(|p| p.element == port)
);
assert!(
crate::diagram_usage::saved_usages_for(app.project(), port, Some(diagram))
.iter()
.any(|usage| matches!(usage.target,
crate::diagram_usage::Target::Port { port: found, .. } if found == port))
);
}
#[test]