Unit tests for removing trailing zeroes and removing whitespace/commas before negative coords in path data

This commit is contained in:
JSCHILL1 2009-04-26 20:38:22 -05:00
parent 5d7e3a075c
commit d6d4d3d027
3 changed files with 19 additions and 2 deletions

View file

@ -20,6 +20,7 @@
import unittest
import scour
import xml.dom.minidom
from svg_regex import svg_parser
SVGNS = 'http://www.w3.org/2000/svg'
@ -421,6 +422,19 @@ class DoNotCollapseMultiplyReferencedGradients(unittest.TestCase):
self.assertNotEquals(len(doc.getElementsByTagNameNS(SVGNS, 'linearGradient')), 0,
'Multiply-referenced linear gradient collapsed' )
class RemoveTrailingZeroesFromPath(unittest.TestCase):
def runTest(self):
doc = scour.scourXmlFile('unittests/path-truncate-zeroes.svg')
path = doc.getElementsByTagNameNS(SVGNS, 'path')[0].getAttribute('d')
self.assertEquals(path[:4] == 'M300' and path[4] != '.', True,
'Trailing zeros not removed from path data' )
class RemoveDelimiterBeforeNegativeCoordsInPath(unittest.TestCase):
def runTest(self):
doc = scour.scourXmlFile('unittests/path-truncate-zeroes.svg')
path = doc.getElementsByTagNameNS(SVGNS, 'path')[0].getAttribute('d')
self.assertEquals(path[4], '-',
'Delimiters not removed before negative coordinate in path data' )
#class RemoveUnreferencedFonts(unittest.TestCase):
# def runTest(self):