Add unittest for --set-c-precision (7cb0d36d72)
This commit is contained in:
parent
25cfcd9a58
commit
a37c98ffe1
2 changed files with 27 additions and 0 deletions
14
testscour.py
14
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):
|
||||
|
|
|
|||
13
unittests/path-precision-control-points.svg
Normal file
13
unittests/path-precision-control-points.svg
Normal 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 |
Loading…
Add table
Add a link
Reference in a new issue