no need to massage expected test_reverse_point_pen
This commit is contained in:
parent
b64b41f645
commit
4f486ad92e
@ -499,8 +499,8 @@ def test_reverse_pen_outputImpliedClosingLine():
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("contour, expected", [(c, e) for c, _, e in TEST_DATA])
|
||||
def test_reverse_point_pen(contour, expected):
|
||||
@pytest.mark.parametrize("contour, outputImpliedClosingLine, expected", TEST_DATA)
|
||||
def test_reverse_point_pen(contour, outputImpliedClosingLine, expected):
|
||||
from fontTools.ufoLib.pointPen import (
|
||||
ReverseContourPointPen,
|
||||
PointToSegmentPen,
|
||||
@ -508,24 +508,10 @@ def test_reverse_point_pen(contour, expected):
|
||||
)
|
||||
|
||||
recpen = RecordingPen()
|
||||
pt2seg = PointToSegmentPen(recpen, outputImpliedClosingLine=True)
|
||||
pt2seg = PointToSegmentPen(recpen, outputImpliedClosingLine)
|
||||
revpen = ReverseContourPointPen(pt2seg)
|
||||
seg2pt = SegmentToPointPen(revpen)
|
||||
for operator, operands in contour:
|
||||
getattr(seg2pt, operator)(*operands)
|
||||
|
||||
# for closed contours that have a lineTo following the moveTo,
|
||||
# and whose points don't overlap, our current implementation diverges
|
||||
# from the ReverseContourPointPen as wrapped by ufoLib's pen converters.
|
||||
# In the latter case, an extra lineTo is added because of
|
||||
# outputImpliedClosingLine=True. This is redundant but not incorrect,
|
||||
# as the number of points is the same in both.
|
||||
if (
|
||||
contour
|
||||
and contour[-1][0] == "closePath"
|
||||
and contour[1][0] == "lineTo"
|
||||
and contour[1][1] != contour[0][1]
|
||||
):
|
||||
expected = expected[:-1] + [("lineTo", contour[0][1])] + expected[-1:]
|
||||
|
||||
assert recpen.value == expected
|
||||
|
Loading…
x
Reference in New Issue
Block a user