diff --git a/test/test_parsing.py b/test/test_parsing.py index 3cdcfc2..c052ad8 100644 --- a/test/test_parsing.py +++ b/test/test_parsing.py @@ -137,31 +137,3 @@ class TestParser(unittest.TestCase): def test_errors(self): self.assertRaises(ValueError, parse_path, 'M 100 100 L 200 200 Z 100 200') - - def test_roundoff(self): - """Paths with arc segments may have floating point round-off issues""" - path1 = parse_path(""" - M160.172,102.95 - L159.922,102.95 - A0.025,0.025 0 0,1 159.897,102.925 - L159.897,102.675 - A0.025,0.025 0 0,1 159.922,102.65 - L160.172,102.65 - A0.025,0.025 0 0,1 160.197,102.675 - L160.197,102.925 - A0.025,0.025 0 0,1 160.172,102.95""") - - path2 = Path(Line(start=(160.172 + 102.95j), end=(159.922 + 102.95j)), - Arc(start=(159.922 + 102.95j), radius=(0.025 + 0.025j), rotation=0.0, - large_arc=False, sweep=True, end=(159.897 + 102.925j)), - Line(start=(159.897 + 102.925j), end=(159.897 + 102.675j)), - Arc(start=(159.897 + 102.675j), radius=(0.025 + 0.025j), rotation=0.0, - large_arc=False, sweep=True, end=(159.922 + 102.65j)), - Line(start=(159.922 + 102.65j), end=(160.172 + 102.65j)), - Arc(start=(160.172 + 102.65j), radius=(0.025 + 0.025j), rotation=0.0, - large_arc=False, sweep=True, end=(160.197 + 102.675j)), - Line(start=(160.197 + 102.675j), end=(160.197 + 102.925j)), - Arc(start=(160.197 + 102.925j), radius=(0.025 + 0.025j), rotation=0.0, - large_arc=False, sweep=True, end=(160.172 + 102.95j))) - - self.assertEqual(path1, path2) diff --git a/test/test_path.py b/test/test_path.py index e69499b..3456e82 100644 --- a/test/test_path.py +++ b/test/test_path.py @@ -353,6 +353,18 @@ class QuadraticBezierTest(unittest.TestCase): class ArcTest(unittest.TestCase): + def test_trusting_acos(self): + """`u1.real` is > 1 in this arc due to numerical error.""" + try: + a1 = Arc(start=(160.197+102.925j), + radius=(0.025+0.025j), + rotation=0.0, + large_arc=False, + sweep=True, + end=(160.172+102.95j)) + except ValueError: + self.fail("Arc() raised ValueError unexpectedly!") + def test_points(self): arc1 = Arc(0j, 100 + 50j, 0, 0, 0, 100 + 50j) self.assertAlmostEqual(arc1.center, 100 + 0j)