reverseContourPen_test: check outputImpliedClosingLine works as expected
I looked at this again and got suspicious becuase I noticed that the number of pen commands increased from 4 to 6, whereas I only expected it to be 5 (4+1) in the outputImpliedClosingLine=True case. Turns out we are adding an extra duplicate lineTo right after moveTo, which I think is not correct.
This commit is contained in:
parent
bf265ce49e
commit
81279d2ed6
@ -288,7 +288,13 @@ def test_reverse_pen_outputImpliedClosingLine():
|
|||||||
revpen.lineTo((0, 10))
|
revpen.lineTo((0, 10))
|
||||||
revpen.lineTo((0, 0))
|
revpen.lineTo((0, 0))
|
||||||
revpen.closePath()
|
revpen.closePath()
|
||||||
assert len(recpen.value) == 4
|
assert recpen.value == [
|
||||||
|
("moveTo", ((0, 0),)),
|
||||||
|
("lineTo", ((0, 10),)),
|
||||||
|
("lineTo", ((10, 0),)),
|
||||||
|
# ("lineTo", ((0, 0),)), # implied
|
||||||
|
("closePath", ()),
|
||||||
|
]
|
||||||
|
|
||||||
recpen = RecordingPen()
|
recpen = RecordingPen()
|
||||||
revpen = ReverseContourPen(recpen, outputImpliedClosingLine=True)
|
revpen = ReverseContourPen(recpen, outputImpliedClosingLine=True)
|
||||||
@ -297,7 +303,13 @@ def test_reverse_pen_outputImpliedClosingLine():
|
|||||||
revpen.lineTo((0, 10))
|
revpen.lineTo((0, 10))
|
||||||
revpen.lineTo((0, 0))
|
revpen.lineTo((0, 0))
|
||||||
revpen.closePath()
|
revpen.closePath()
|
||||||
assert len(recpen.value) == 6
|
assert recpen.value == [
|
||||||
|
("moveTo", ((0, 0),)),
|
||||||
|
("lineTo", ((0, 10),)),
|
||||||
|
("lineTo", ((10, 0),)),
|
||||||
|
("lineTo", ((0, 0),)), # not implied
|
||||||
|
("closePath", ()),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("contour, expected", TEST_DATA)
|
@pytest.mark.parametrize("contour, expected", TEST_DATA)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user