Add unittests for b00b374e64 and 8f87118725
This commit is contained in:
parent
8f87118725
commit
a69efb3a55
2 changed files with 42 additions and 3 deletions
34
testscour.py
34
testscour.py
|
|
@ -956,6 +956,40 @@ class LimitPrecisionInPathData(unittest.TestCase):
|
||||||
'Not correctly limiting precision on path data')
|
'Not correctly limiting precision on path data')
|
||||||
|
|
||||||
|
|
||||||
|
class KeepPrecisionInPathDataIfSameLength(unittest.TestCase):
|
||||||
|
|
||||||
|
def runTest(self):
|
||||||
|
doc = scourXmlFile('unittests/path-precision.svg', parse_args(['--set-precision=1']))
|
||||||
|
paths = doc.getElementsByTagNameNS(SVGNS, 'path')
|
||||||
|
for path in paths[1:3]:
|
||||||
|
self.assertEqual(path.getAttribute('d'), "m1 12 123 1e3 1e4 1e5",
|
||||||
|
'Precision not correctly reduced with "--set-precision=1" '
|
||||||
|
'for path with ID ' + path.getAttribute('id'))
|
||||||
|
self.assertEqual(paths[4].getAttribute('d'), "m-1-12-123-1e3 -1e4 -1e5",
|
||||||
|
'Precision not correctly reduced with "--set-precision=1" '
|
||||||
|
'for path with ID ' + paths[4].getAttribute('id'))
|
||||||
|
|
||||||
|
doc = scourXmlFile('unittests/path-precision.svg', parse_args(['--set-precision=2']))
|
||||||
|
paths = doc.getElementsByTagNameNS(SVGNS, 'path')
|
||||||
|
for path in paths[1:3]:
|
||||||
|
self.assertEqual(path.getAttribute('d'), "m1 12 123 1234 12345 1.2e5",
|
||||||
|
'Precision not correctly reduced with "--set-precision=2" '
|
||||||
|
'for path with ID ' + path.getAttribute('id'))
|
||||||
|
self.assertEqual(paths[4].getAttribute('d'), "m-1-12-123-1234-12345-1.2e5",
|
||||||
|
'Precision not correctly reduced with "--set-precision=2" '
|
||||||
|
'for path with ID ' + paths[4].getAttribute('id'))
|
||||||
|
|
||||||
|
doc = scourXmlFile('unittests/path-precision.svg', parse_args(['--set-precision=3']))
|
||||||
|
paths = doc.getElementsByTagNameNS(SVGNS, 'path')
|
||||||
|
for path in paths[1:3]:
|
||||||
|
self.assertEqual(path.getAttribute('d'), "m1 12 123 1234 12345 123456",
|
||||||
|
'Precision not correctly reduced with "--set-precision=3" '
|
||||||
|
'for path with ID ' + path.getAttribute('id'))
|
||||||
|
self.assertEqual(paths[4].getAttribute('d'), "m-1-12-123-1234-12345-123456",
|
||||||
|
'Precision not correctly reduced with "--set-precision=3" '
|
||||||
|
'for path with ID ' + paths[4].getAttribute('id'))
|
||||||
|
|
||||||
|
|
||||||
class RemoveEmptyLineSegmentsFromPath(unittest.TestCase):
|
class RemoveEmptyLineSegmentsFromPath(unittest.TestCase):
|
||||||
|
|
||||||
def runTest(self):
|
def runTest(self):
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,9 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<svg viewBox="0 0 400 400" xmlns="http://www.w3.org/2000/svg" version="1.1">
|
<svg vxmlns="http://www.w3.org/2000/svg">
|
||||||
<path d="M 100.0000001 99.9999999 h100.01 v123456789.123456789 h-100 z" fill="red" />
|
<path id="p0" d="M 100.0000001 99.9999999 h100.01 v123456789.123456789 h-100 z" />
|
||||||
|
|
||||||
|
<path id="p1" d="m 1 12 123 1234 12345 123456 " />
|
||||||
|
<path id="p2" d="m 1.0 12.0 123.0 1234.0 12345.0 123456.0" />
|
||||||
|
<path id="p3" d="m 01 012 0123 01234 012345 0123456 " />
|
||||||
|
<path id="p4" d="m -1 -12 -123 -1234 -12345 -123456 " />
|
||||||
</svg>
|
</svg>
|
||||||
|
|
|
||||||
|
Before Width: | Height: | Size: 227 B After Width: | Height: | Size: 456 B |
Loading…
Add table
Add a link
Reference in a new issue