def test_transform(): path = Path() path.line_to((2, 0)) path.curve_to((4, 0), (2, 1), (4, 1)) p2 = path.transform(Matrix44.translate(1, 1, 0)) assert p2.start == (1, 1) assert p2[0][1] == (3, 1) # line to location assert p2[1][1] == (5, 1) # cubic to location assert p2[1][2] == (3, 2) # cubic ctrl1 assert p2[1][3] == (5, 2) # cubic ctrl2 assert p2.end == (5, 1)
def test_two_paths_multiple_commands(self): path_a = Path() path_a.line_to((1, 0)) path_a.curve3_to((2, 0), (2.5, 1)) path_a.curve4_to((3, 0), (2, 1), (3, 1)) path_b = path_a.transform(Matrix44.translate(4, 0, 0)) result = transform_paths([path_a, path_b], Matrix44()) path0 = result[0] assert path0[0].type == Command.LINE_TO assert path0[1].type == Command.CURVE3_TO assert path0[2].type == Command.CURVE4_TO assert path0.start == (0, 0) assert path0.end == (3, 0) path1 = result[1] assert path1[0].type == Command.LINE_TO assert path1[1].type == Command.CURVE3_TO assert path1[2].type == Command.CURVE4_TO assert path1.start == (4, 0) assert path1.end == (7, 0)