diff --git a/capellambse_context_diagrams/context.py b/capellambse_context_diagrams/context.py index 41f85941..a9786c31 100644 --- a/capellambse_context_diagrams/context.py +++ b/capellambse_context_diagrams/context.py @@ -540,12 +540,11 @@ def _create_diagram(self, params: dict[str, t.Any]) -> cdiagram.Diagram: for edge in edges: layout.children.append( _elkjs.ELKOutputEdge( - id=edge.id, + id=f"__Realization:{edge.id}", type="edge", sourceId=edge.sources[0], targetId=edge.targets[0], routingPoints=[], - styleclass="Realization", ) ) self._add_layer_labels(layout) diff --git a/capellambse_context_diagrams/serializers.py b/capellambse_context_diagrams/serializers.py index 0bb5aae2..a5f9c806 100644 --- a/capellambse_context_diagrams/serializers.py +++ b/capellambse_context_diagrams/serializers.py @@ -93,6 +93,7 @@ def make_diagram( self.diagram.calculate_viewport() self.order_children() + self._edges.clear() return self.diagram def deserialize_child( diff --git a/tests/test_context_diagrams.py b/tests/test_context_diagrams.py index 3a722030..22032299 100644 --- a/tests/test_context_diagrams.py +++ b/tests/test_context_diagrams.py @@ -23,12 +23,13 @@ "f0bc11ba-89aa-4297-98d2-076440e9117f", } TEST_DERIVED_UUID = "dbd99773-efb6-4476-bf5c-270a61f18b09" +TEST_ENTITY_UUID = "e37510b9-3166-4f80-a919-dfaac9b696c7" @pytest.mark.parametrize( "uuid", [ - pytest.param("e37510b9-3166-4f80-a919-dfaac9b696c7", id="Entity"), + pytest.param(TEST_ENTITY_UUID, id="Entity"), pytest.param("8bcb11e6-443b-4b92-bec2-ff1d87a224e7", id="Activity"), pytest.param( "344a405e-c7e5-4367-8a9a-41d3d9a27f81", id="SystemComponent" @@ -58,10 +59,31 @@ def test_context_diagrams(model: capellambse.MelodyModel, uuid: str) -> None: obj = model.by_uuid(uuid) diag = obj.context_diagram + diag.render(None, display_parent_relation=True) + diag.render(None, display_parent_relation=False) assert diag.nodes +@pytest.mark.parametrize( + "parameter", + [ + "display_parent_relation", + "display_symbols_as_boxes", + "display_derived_interfaces", + "slim_center_box", + ], +) +def test_context_diagrams_rerender_on_parameter_change( + model: capellambse.MelodyModel, parameter: str +) -> None: + obj = model.by_uuid(TEST_ENTITY_UUID) + + diag = obj.context_diagram + diag.render(None, **{parameter: True}) + diag.render(None, **{parameter: False}) + + @pytest.mark.parametrize( "diagram_elements", [