예제 #1
0
 def test_for_very_short_line_segments(self, start, delta):
     path = Path((start, 0, 0))
     path.line_to((start + delta, 0, 0))
     path = lines_to_curve4(path)
     assert len(path) == 1
     assert path[0].type == Command.CURVE4_TO
     assert len(list(path.flattening(1))) > 3
예제 #2
0
 def test_which_length_is_too_short_to_create_a_curve(self, start, delta):
     path = Path((start, 0, 0))
     path.line_to((start + delta, 0, 0))
     path = lines_to_curve4(path)
     assert len(path) == 1
     assert (
         path[0].type == Command.LINE_TO
     ), "should not remove a single line segment representing a point"
     assert len(list(path.flattening(1))) == 2
예제 #3
0
 def test_remove_line_segments_of_zero_length_at_the_end(self):
     # CURVE3_TO and CURVE4_TO can not process zero length segments
     path = Path()
     path.line_to((1, 0))
     path.line_to((1, 0))  # line segment of length==0 should be removed
     path = lines_to_curve4(path)
     assert len(path) == 1
     assert path.start == (0, 0)
     assert path[0].type == Command.CURVE4_TO
     assert path[0].end == (1, 0)
예제 #4
0
 def test_does_not_remove_a_line_representing_a_single_point(self):
     path = Path((1, 0))
     path.line_to((1, 0))  # represents the point (1, 0)
     path = lines_to_curve4(path)
     assert len(path) == 1
     assert path[0].type == Command.LINE_TO
예제 #5
0
 def test_create_a_curve4_command(self):
     path = Path()
     path.line_to((1, 0))
     path = lines_to_curve4(path)
     assert path[0].type == Command.CURVE4_TO