aboutsummaryrefslogtreecommitdiff
path: root/Tests/misc/bezierTools_test.py
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/misc/bezierTools_test.py')
-rw-r--r--Tests/misc/bezierTools_test.py22
1 files changed, 20 insertions, 2 deletions
diff --git a/Tests/misc/bezierTools_test.py b/Tests/misc/bezierTools_test.py
index 9096f278..c5cd1b73 100644
--- a/Tests/misc/bezierTools_test.py
+++ b/Tests/misc/bezierTools_test.py
@@ -1,6 +1,5 @@
-from fontTools.misc.py23 import *
from fontTools.misc.bezierTools import (
- calcQuadraticBounds, calcCubicBounds, splitLine, splitQuadratic,
+ calcQuadraticBounds, calcCubicBounds, segmentPointAtT, splitLine, splitQuadratic,
splitCubic, splitQuadraticAtT, splitCubicAtT, solveCubic)
import pytest
@@ -130,3 +129,22 @@ def test_solveCubic():
assert solveCubic(1.0, -4.5, 6.75, -3.375) == [1.5, 1.5, 1.5]
assert solveCubic(-12.0, 18.0, -9.0, 1.50023651123) == [0.5, 0.5, 0.5]
assert solveCubic(9.0, 0.0, 0.0, -7.62939453125e-05) == [-0.0, -0.0, -0.0]
+
+
+_segmentPointAtT_testData = [
+ ([(0, 10), (200, 100)], 0.0, (0, 10)),
+ ([(0, 10), (200, 100)], 0.5, (100, 55)),
+ ([(0, 10), (200, 100)], 1.0, (200, 100)),
+ ([(0, 10), (100, 100), (200, 50)], 0.0, (0, 10)),
+ ([(0, 10), (100, 100), (200, 50)], 0.5, (100, 65.0)),
+ ([(0, 10), (100, 100), (200, 50)], 1.0, (200, 50.0)),
+ ([(0, 10), (100, 100), (200, 100), (300, 0)], 0.0, (0, 10)),
+ ([(0, 10), (100, 100), (200, 100), (300, 0)], 0.5, (150, 76.25)),
+ ([(0, 10), (100, 100), (200, 100), (300, 0)], 1.0, (300, 0)),
+]
+
+
+@pytest.mark.parametrize("segment, t, expectedPoint", _segmentPointAtT_testData)
+def test_segmentPointAtT(segment, t, expectedPoint):
+ point = segmentPointAtT(segment, t)
+ assert expectedPoint == point