def test_guessSmooth_tangent(self): tpen = _TestPointPen() pen = GuessSmoothPointPen(tpen) pen.beginPath() pen.addPoint((0, 0), segmentType="move") pen.addPoint((0, 100), segmentType="line") pen.addPoint((3, 200)) pen.addPoint((300, 200)) pen.addPoint((400, 200), segmentType="curve") pen.endPath() self.assertEqual( "beginPath() addPoint((0, 0), segmentType='move') " "addPoint((0, 100), segmentType='line', smooth=True) " "addPoint((3, 200)) addPoint((300, 200)) " "addPoint((400, 200), segmentType='curve') endPath()", repr(tpen))
def test_guessSmooth_almost(self): tpen = _TestPointPen() pen = GuessSmoothPointPen(tpen) pen.beginPath() pen.addPoint((0, 100), segmentType="curve") pen.addPoint((1, 200)) pen.addPoint((395, 200)) pen.addPoint((400, 100), segmentType="curve") pen.addPoint((400, 0)) pen.addPoint((0, 0)) pen.endPath() self.assertEqual( "beginPath() addPoint((0, 100), segmentType='curve', smooth=True) " "addPoint((1, 200)) addPoint((395, 200)) " "addPoint((400, 100), segmentType='curve', smooth=True) " "addPoint((400, 0)) addPoint((0, 0)) endPath()", repr(tpen))
def test_guessSmooth_exact(self): tpen = _TestPointPen() pen = GuessSmoothPointPen(tpen) pen.beginPath(identifier="foo") pen.addPoint((0, 100), segmentType="curve") pen.addPoint((0, 200)) pen.addPoint((400, 200), identifier='bar') pen.addPoint((400, 100), segmentType="curve") pen.addPoint((400, 0)) pen.addPoint((0, 0)) pen.endPath() self.assertEqual( "beginPath(identifier='foo') " "addPoint((0, 100), segmentType='curve', smooth=True) " "addPoint((0, 200)) addPoint((400, 200), identifier='bar') " "addPoint((400, 100), segmentType='curve', smooth=True) " "addPoint((400, 0)) addPoint((0, 0)) endPath()", repr(tpen))