Compose saved Scenario authoring with current Text and input authority
This commit is contained in:
@@ -352,7 +352,8 @@ impl Transition {
|
||||
}
|
||||
|
||||
fn result_view_compatible(p: &Project, diagram: &Diagram, targets: &[Id], layer: Layer) -> bool {
|
||||
(diagram.layer == layer || diagram.projection == ProjectionKind::Traceability)
|
||||
(diagram.projection.is_architecture() || diagram.projection.state_machine().is_some())
|
||||
&& (diagram.layer == layer || diagram.projection == ProjectionKind::Traceability)
|
||||
&& (diagram.projection.state_machine().is_none() || !targets.is_empty())
|
||||
&& targets.iter().all(|id| {
|
||||
p.elements.get(id).is_some_and(|e| {
|
||||
@@ -1972,3 +1973,37 @@ mod port_authoring_tests {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod saved_scenario_destination_tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn empty_transition_results_do_not_make_a_scenario_an_architecture_destination() {
|
||||
let mut p = Project::empty();
|
||||
let owner = p
|
||||
.add_element(Kind::Scenario, Layer::Oa, "Scenario", None)
|
||||
.unwrap();
|
||||
let mut diagram = Diagram {
|
||||
id: Id::new_v4(),
|
||||
alias: "target_view".into(),
|
||||
name: "Target".into(),
|
||||
description: String::new(),
|
||||
layer: Layer::Oa,
|
||||
projection: ProjectionKind::Scenario { scenario: owner },
|
||||
view_options: Default::default(),
|
||||
nodes: Default::default(),
|
||||
routes: vec![],
|
||||
layout: None,
|
||||
};
|
||||
assert!(!result_view_compatible(&p, &diagram, &[], Layer::Oa));
|
||||
let machine = p
|
||||
.add_element(Kind::StateMachine, Layer::Oa, "Machine", None)
|
||||
.unwrap();
|
||||
diagram.projection = ProjectionKind::StateMachine { machine };
|
||||
assert!(result_view_compatible(&p, &diagram, &[machine], Layer::Oa));
|
||||
assert!(!result_view_compatible(&p, &diagram, &[], Layer::Oa));
|
||||
diagram.projection = ProjectionKind::Overview;
|
||||
assert!(result_view_compatible(&p, &diagram, &[], Layer::Oa));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user