예제 #1
0
def test_control_vertices(p1):
    vertices = list(p1.control_vertices())
    assert vertices == Vector.list([(0, 0), (2, 0), (2, 1), (4, 1), (4, 0)])
    path = Path()
    assert len(list(path.control_vertices())) == 0
    path = Path.from_vertices([(0, 0), (1, 0)])
    assert len(list(path.control_vertices())) == 2
예제 #2
0
def test_has_clockwise_orientation():
    # basic has_clockwise_orientation() function is tested in:
    # test_617_clockwise_orientation
    path = Path.from_vertices([(0, 0), (1, 0), (1, 1), (0, 1)])
    assert path.has_clockwise_orientation() is True

    path = Path()
    path.line_to((2, 0))
    path.curve_to((4, 0), (2, 1), (4, 1))  # end, ctrl1, ctrl2
    assert path.has_clockwise_orientation() is False
예제 #3
0
 def test_only_vertices(self):
     p = Path.from_vertices([(1, 0), (2, 0), (3, 1)])
     result = list(to_bsplines_and_vertices(p))
     assert len(result) == 1, "expected one list of vertices"
     assert len(result[0]) == 3, "expected 3 vertices"