Add unittest for --set-c-precision (7cb0d36d72)

This commit is contained in:
Eduard Braun 2017-02-25 19:33:03 +01:00
parent 51c1e6af23
commit 98e3040645
2 changed files with 27 additions and 0 deletions

View file

@ -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):

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg">
<path d="m 1.11 2.22 3.33 4.44
M 0 0
C 1.11 2.22 3.33 4.44 5.55 6.66
c 1.11 2.22 3.33 4.44 5.55 6.66 1.11 2.22 3.33 4.44 5.55 6.66
M 0 0
S 1.11 2.22 3.33 4.44
s 1.11 2.22 3.33 4.44 1.11 2.22 3.33 4.44
M 0 0
Q 1.11 2.22 3.33 4.44
q 1.11 2.22 3.33 4.44 1.11 2.22 3.33 4.44" />
</svg>

After

Width:  |  Height:  |  Size: 463 B