Even better fix for 8f87118725
(previous solution still did not work for numbers like 123.4 with precision < 3)
This commit is contained in:
parent
7c2e035644
commit
f5a61eeeb3
3 changed files with 29 additions and 15 deletions
22
testscour.py
22
testscour.py
|
|
@ -968,6 +968,9 @@ class KeepPrecisionInPathDataIfSameLength(unittest.TestCase):
|
|||
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'))
|
||||
self.assertEqual(paths[5].getAttribute('d'), "m123 101-123-101",
|
||||
'Precision not correctly reduced with "--set-precision=1" '
|
||||
'for path with ID ' + paths[5].getAttribute('id'))
|
||||
|
||||
doc = scourXmlFile('unittests/path-precision.svg', parse_args(['--set-precision=2']))
|
||||
paths = doc.getElementsByTagNameNS(SVGNS, 'path')
|
||||
|
|
@ -978,6 +981,9 @@ class KeepPrecisionInPathDataIfSameLength(unittest.TestCase):
|
|||
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'))
|
||||
self.assertEqual(paths[5].getAttribute('d'), "m123 101-123-101",
|
||||
'Precision not correctly reduced with "--set-precision=2" '
|
||||
'for path with ID ' + paths[5].getAttribute('id'))
|
||||
|
||||
doc = scourXmlFile('unittests/path-precision.svg', parse_args(['--set-precision=3']))
|
||||
paths = doc.getElementsByTagNameNS(SVGNS, 'path')
|
||||
|
|
@ -988,6 +994,22 @@ class KeepPrecisionInPathDataIfSameLength(unittest.TestCase):
|
|||
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'))
|
||||
self.assertEqual(paths[5].getAttribute('d'), "m123 101-123-101",
|
||||
'Precision not correctly reduced with "--set-precision=3" '
|
||||
'for path with ID ' + paths[5].getAttribute('id'))
|
||||
|
||||
doc = scourXmlFile('unittests/path-precision.svg', parse_args(['--set-precision=4']))
|
||||
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=4" '
|
||||
'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=4" '
|
||||
'for path with ID ' + paths[4].getAttribute('id'))
|
||||
self.assertEqual(paths[5].getAttribute('d'), "m123.5 101-123.5-101",
|
||||
'Precision not correctly reduced with "--set-precision=4" '
|
||||
'for path with ID ' + paths[5].getAttribute('id'))
|
||||
|
||||
|
||||
class RemoveEmptyLineSegmentsFromPath(unittest.TestCase):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue