Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions tests/draw/svg/test_paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,34 @@ def test_path_a7(assert_pixels):
''')


@assert_no_logs
def test_path_a_zero_radius(assert_pixels):
# Arcs with a zero radius are straight lines to their absolute end point.
assert_pixels('''
____________
____________
__BBBBBB____
__BBBBBB____
__BBBBBB____
__BBBBBB____
__BBBBBB____
__BBBBBB____
____________
____________
____________
____________
''', '''
<style>
@page { size: 12px }
svg { display: block }
</style>
<svg width="12px" height="12px" xmlns="http://www.w3.org/2000/svg">
<path d="M 2 2 L 8 2 A 0 0 0 0 1 8 2 L 8 8 A 0 2 0 0 1 2 8 Z"
fill="blue"/>
</svg>
''')


@assert_no_logs
def test_path_wrong_point(assert_pixels):
assert_pixels('''
Expand Down
4 changes: 2 additions & 2 deletions weasyprint/svg/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ def path(svg, node, font_size):
# rx=0 or ry=0 means straight line
if not rx or not ry:
if string := string.strip():
# As we replace the current operation by l, we must be sure
# As we replace the current operation by L, we must be sure
# that the next letter is set to the real current letter (a
# or A) in case it’s omitted
matches.appendleft((letter, string))
matches.appendleft(('l', f'{x3} {y3}'))
matches.appendleft(('L', f'{x3} {y3}'))
continue

# Cancel the rotation of the second point
Expand Down