From 98e3040645e3a3eed919f4f6f2ed66f0509f9601 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sat, 25 Feb 2017 19:33:03 +0100 Subject: [PATCH] Add unittest for `--set-c-precision` (7cb0d36d72e3fbef79e30fb744ea5f966051015c) --- testscour.py | 14 ++++++++++++++ unittests/path-precision-control-points.svg | 13 +++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 unittests/path-precision-control-points.svg diff --git a/testscour.py b/testscour.py index d73090d..894733b 100755 --- a/testscour.py +++ b/testscour.py @@ -1014,6 +1014,20 @@ class KeepPrecisionInPathDataIfSameLength(unittest.TestCase): 'for path with ID ' + paths[5].getAttribute('id')) +class LimitPrecisionInControlPointPathData(unittest.TestCase): + + def runTest(self): + path_data = ("m1.1 2.2 3.3 4.4m-4.4-6.7" + "c1 2 3 4 5.6 6.7 1 2 3 4 5.6 6.7 1 2 3 4 5.6 6.7m-17-20" + "s1 2 3.3 4.4 1 2 3.3 4.4 1 2 3.3 4.4m-10-13" + "q1 2 3.3 4.4 1 2 3.3 4.4 1 2 3.3 4.4") + doc = scourXmlFile('unittests/path-precision-control-points.svg', + parse_args(['--set-precision=2', '--set-c-precision=1'])) + path_data2 = doc.getElementsByTagNameNS(SVGNS, 'path')[0].getAttribute('d') + self.assertEqual(path_data2, path_data, + 'Not correctly limiting precision on path data with --set-c-precision') + + class RemoveEmptyLineSegmentsFromPath(unittest.TestCase): def runTest(self): diff --git a/unittests/path-precision-control-points.svg b/unittests/path-precision-control-points.svg new file mode 100644 index 0000000..add0f58 --- /dev/null +++ b/unittests/path-precision-control-points.svg @@ -0,0 +1,13 @@ + + + +