Integrate typed port authoring and reviewable exchange workflows
This commit is contained in:
@@ -17,6 +17,19 @@ fn fixture() -> Project {
|
||||
p.relate(RelationKind::Allocation, "Performs", owner, work);
|
||||
p
|
||||
}
|
||||
#[test]
|
||||
fn system_only_models_open_the_populated_perspective() {
|
||||
let mut p = Project::empty();
|
||||
p.add_element(Kind::Function, Layer::Sa, "Receive report", None)
|
||||
.unwrap();
|
||||
let diagram = p.ensure_diagram(Layer::Sa);
|
||||
let app = App::with_project(p);
|
||||
assert_eq!(app.layer, Layer::Sa);
|
||||
assert_eq!(app.active_diagram, Some(diagram));
|
||||
assert_eq!(app.create_kind, Kind::Function);
|
||||
assert_eq!(App::with_project(Project::empty()).layer, Layer::Oa);
|
||||
assert_eq!(App::with_project(Project::demo()).layer, Layer::Oa);
|
||||
}
|
||||
fn source(app: &mut App, text: &str) {
|
||||
send(app, Message::Page(Page::Text));
|
||||
send(app, Message::SourceEdit(text_editor::Action::SelectAll));
|
||||
@@ -42,7 +55,10 @@ fn opening_and_creating_models_preserve_the_actual_window_size_for_fit() {
|
||||
&mut app,
|
||||
Message::Loaded(Ok(Some((
|
||||
std::path::PathBuf::from("resized-model.arcadia"),
|
||||
project.clone(),
|
||||
persistence::DecodeResult {
|
||||
project: project.clone(),
|
||||
migration: None,
|
||||
},
|
||||
std::sync::Arc::from(language::format(&project).into_bytes()),
|
||||
)))),
|
||||
);
|
||||
@@ -75,6 +91,31 @@ fn every_demo_record_has_a_lossless_graphical_draft() {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn opening_legacy_source_surfaces_report_without_modifying_original_bytes() {
|
||||
let bytes: std::sync::Arc<[u8]> = std::sync::Arc::from(
|
||||
include_bytes!("../../oa-core/tests/fixtures/v2-coastal-rescue.json").as_slice(),
|
||||
);
|
||||
let decoded = persistence::decode_with_report(&bytes).unwrap();
|
||||
let original = decoded.project.clone();
|
||||
let report = decoded.migration.clone().unwrap();
|
||||
let mut app = App::with_project(Project::empty());
|
||||
send(
|
||||
&mut app,
|
||||
Message::Loaded(Ok(Some((
|
||||
std::path::PathBuf::from("legacy.json"),
|
||||
decoded,
|
||||
bytes.clone(),
|
||||
)))),
|
||||
);
|
||||
assert_eq!(app.migration, Some(report));
|
||||
assert_eq!(app.page, Page::Validation);
|
||||
assert_eq!(app.project(), &original);
|
||||
assert!(!app.dirty());
|
||||
assert!(app.source_snapshot.starts_with("arcadia 3;"));
|
||||
assert!(serde_json::from_slice::<serde_json::Value>(&bytes).unwrap()["schema_version"] == 2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fit_uses_measured_canvas_bounds_and_preserves_them_on_open() {
|
||||
let p = fixture();
|
||||
@@ -85,7 +126,10 @@ fn fit_uses_measured_canvas_bounds_and_preserves_them_on_open() {
|
||||
&mut app,
|
||||
Message::Loaded(Ok(Some((
|
||||
std::path::PathBuf::from("measured.arcadia"),
|
||||
p.clone(),
|
||||
persistence::DecodeResult {
|
||||
project: p.clone(),
|
||||
migration: None,
|
||||
},
|
||||
std::sync::Arc::from(language::format(&p).into_bytes()),
|
||||
)))),
|
||||
);
|
||||
@@ -1135,9 +1179,28 @@ fn nested_allocation_insertion_reflows_sibling_subtrees_and_preserves_fold_state
|
||||
let b_work = p
|
||||
.add_element(Kind::Activity, Layer::Oa, "B work", None)
|
||||
.unwrap();
|
||||
let b_port = p
|
||||
.add_element(Kind::Port, Layer::Oa, "B boundary", Some(b))
|
||||
.unwrap();
|
||||
// A preserved OA boundary remains explicit Legacy content in schema3.
|
||||
let b_port = Id::new_v4();
|
||||
p.elements.insert(
|
||||
b_port,
|
||||
oa_core::Element {
|
||||
id: b_port,
|
||||
alias: "b_boundary".into(),
|
||||
name: "B boundary".into(),
|
||||
description: String::new(),
|
||||
parent: Some(b),
|
||||
body: ElementBody::shared_in(
|
||||
Layer::Oa,
|
||||
SharedBody::Port {
|
||||
contract: PortContract::Legacy,
|
||||
legacy: Some(LegacyPortContract {
|
||||
direction: PortDirection::InOut,
|
||||
interface: None,
|
||||
}),
|
||||
},
|
||||
),
|
||||
},
|
||||
);
|
||||
p.relate(RelationKind::Allocation, "A performs", a, a_work);
|
||||
p.relate(RelationKind::Allocation, "B performs", b, b_work);
|
||||
let diagram = p.ensure_diagram(Layer::Oa);
|
||||
|
||||
Reference in New Issue
Block a user