Skip to content

Commit

Permalink
test: Add blackbox test
Browse files Browse the repository at this point in the history
  • Loading branch information
huyenngn committed Jan 22, 2025
1 parent edf2544 commit 3cf9088
Show file tree
Hide file tree
Showing 5 changed files with 501 additions and 23 deletions.
7 changes: 3 additions & 4 deletions src/capellambse_context_diagrams/collectors/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ def _collect_extended_context(
target: m.ModelElement,
) -> cabc.Iterator[m.ModelElement]:
yield from _collect(target)
if not diagram._display_actor_relation:
return
oc_copy = outside_components.copy()
for cmp in oc_copy.values():
yield from _collect(
Expand All @@ -73,10 +75,7 @@ def _collect_extended_context(
),
)

if diagram._display_actor_relationship:
diagram._collect = _collect(diagram.target)
else:
diagram._collect = _collect_extended_context(diagram.target)
diagram._collect = _collect_extended_context(diagram.target)
processor = custom.CustomCollector(diagram, params=params)
processor()
return processor.data
Expand Down
7 changes: 3 additions & 4 deletions src/capellambse_context_diagrams/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ class CustomDiagram(m.AbstractDiagram):
* collect - A list of collected elements.
* unify_edge_direction - Unify the direction of the edges.
* balckbox - Display the object of interest as a black box.
* display_actor_relationship: Show the connections between the context actors.
* display_actor_relation: Show the connections between the context actors.
"""

_display_symbols_as_boxes: bool
Expand All @@ -302,7 +302,7 @@ class CustomDiagram(m.AbstractDiagram):
_collect: cabc.Iterator[m.ModelElement]
_unify_edge_direction: str
_blackbox: bool
_display_actor_relationship: bool
_display_actor_relation: bool

def __init__(
self,
Expand Down Expand Up @@ -333,7 +333,7 @@ def __init__(
"collect": [],
"unify_edge_direction": "NONE",
"blackbox": False,
"display_actor_relationship": False,
"display_actor_relation": False,
} | default_render_parameters

if standard_filter := STANDARD_FILTERS.get(class_):
Expand Down Expand Up @@ -464,7 +464,6 @@ def __init__(
default_render_parameters = {
"slim_center_box": True,
"unify_edge_direction": "SMART",
"blackbox": True,
} | default_render_parameters

super().__init__(
Expand Down
Loading

0 comments on commit 3cf9088

Please sign in to comment.