[qu2cu] Add test for oncurveless contour
This commit is contained in:
parent
b73ff5f171
commit
77d25b332e
@ -160,6 +160,17 @@ class TestQu2CuPen(unittest.TestCase, _TestPenMixin):
|
||||
],
|
||||
)
|
||||
|
||||
def test_qCurveTo_no_oncurve_points(self):
|
||||
pen = DummyPen()
|
||||
cubicpen = Qu2CuPen(pen, MAX_ERR)
|
||||
cubicpen.qCurveTo((0, 0), (1, 0), (1, 1), (0, 1), None)
|
||||
cubicpen.closePath()
|
||||
|
||||
self.assertEqual(
|
||||
str(pen).splitlines(),
|
||||
["pen.qCurveTo((0, 0), (1, 0), (1, 1), (0, 1), None)", "pen.closePath()"],
|
||||
)
|
||||
|
||||
def test_curveTo_1_point(self):
|
||||
pen = DummyPen()
|
||||
cubicpen = Qu2CuPen(pen, MAX_ERR)
|
||||
|
@ -226,7 +226,11 @@ def _repr_pen_commands(commands):
|
||||
# cast float to int if there're no digits after decimal point,
|
||||
# and round floats to 12 decimal digits (more than enough)
|
||||
args = [
|
||||
tuple((int(v) if int(v) == v else round(v, 12)) for v in pt)
|
||||
(
|
||||
tuple((int(v) if int(v) == v else round(v, 12)) for v in pt)
|
||||
if pt is not None
|
||||
else None
|
||||
)
|
||||
for pt in args
|
||||
]
|
||||
args = ", ".join(repr(a) for a in args)
|
||||
|
Loading…
x
Reference in New Issue
Block a user