Skip to content

Commit

Permalink
Fix: While loop rendering problem. closes #44
Browse files Browse the repository at this point in the history
  • Loading branch information
pylover committed Aug 20, 2021
1 parent 3c6a917 commit 24c8e8a
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 3 deletions.
6 changes: 3 additions & 3 deletions adia/renderingplans.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,11 @@ def text(self):
def _calc_singlemodule(self):
self.start = self.startmodule.col

linelen = 0
linelen = len(self.kind) + 5
if self.item.text:
linelen = len(self.item.text)
linelen += len(self.item.text)

self.length = linelen + 7
self.length = linelen
self.end = self.start + self.length
self.end -= 1
return 0, 3, 0
Expand Down
49 changes: 49 additions & 0 deletions tests/test_sequence_selfcall.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,3 +264,52 @@ def test_sequence_condition_inside_selfcall_issue5_test4():
. +-----+ +-----+ +-----+ .
...............................................
''')


def test_sequence_loop_over_selfcall_issue44():
d = Diagram('''
diagram: foo
sequence:
while: Lorem ipsum
foo -> foo
for: Lorem Ipsum
foo -> foo
''')
assert eqdia(d, '''
.........................
. DIAGRAM: foo .
. .
. +-----+ .
. | foo | .
. +-----+ .
. | .
. ********************* .
. * while Lorem ipsum * .
. ********************* .
. | .
. |~~~~~~+ .
. | | .
. |<-----+ .
. | .
. ********************* .
. * end while * .
. ********************* .
. | .
. ******************* .
. * for Lorem Ipsum * .
. ******************* .
. | .
. |~~~~~~+ .
. | | .
. |<-----+ .
. | .
. ******************* .
. * end for * .
. ******************* .
. | .
. +-----+ .
. | foo | .
. +-----+ .
.........................
''')

0 comments on commit 24c8e8a

Please sign in to comment.