Apply a modified patch by Hungerburg to fix bugs 833666, "scour does not clean comments if file starts with a comment", and bug 804238, whereby Scour fails to correctly parse a polygon/polyline if its first coordinate is negative.

Unit tests added for the negative coordinate parsing.
This commit is contained in:
Hungerburg 2011-08-25 22:26:05 -04:00 committed by Louis Simard
parent f8c88f0dfa
commit 60b48353b3
4 changed files with 28 additions and 4 deletions

View file

@ -704,6 +704,19 @@ class ScourPolylineNegativeCoords(unittest.TestCase):
self.assertEquals(p.getAttribute('points'), '100 -100 100 -100 100 -100 -100 -100 -100 200',
'Negative polyline coordinates not properly parsed')
class ScourPolygonNegativeCoordFirst(unittest.TestCase):
def runTest(self):
p = scour.scourXmlFile('unittests/polygon-coord-neg-first.svg').getElementsByTagNameNS(SVGNS, 'polygon')[0]
# points="-100,-100,100-100,100-100-100,-100-100,200" />
self.assertEquals(p.getAttribute('points'), '-100 -100 100 -100 100 -100 -100 -100 -100 200',
'Negative polygon coordinates not properly parsed')
class ScourPolylineNegativeCoordFirst(unittest.TestCase):
def runTest(self):
p = scour.scourXmlFile('unittests/polyline-coord-neg-first.svg').getElementsByTagNameNS(SVGNS, 'polyline')[0]
self.assertEquals(p.getAttribute('points'), '-100 -100 100 -100 100 -100 -100 -100 -100 200',
'Negative polyline coordinates not properly parsed')
class DoNotRemoveGroupsWithIDsInDefs(unittest.TestCase):
def runTest(self):
f = scour.scourXmlFile('unittests/important-groups-in-defs.svg')