Fix Bug 503034 by only removing children of a group in a defs if the group itself is not referenced anywhere else in the file

This commit is contained in:
JSCHILL1 2010-01-04 12:55:23 -06:00
parent 22fd47ab23
commit ed1c522caf
3 changed files with 20 additions and 4 deletions

View file

@ -154,6 +154,13 @@ class RemoveUnreferencedElementInDefs(unittest.TestCase):
self.assertEquals(len(doc.getElementsByTagNameNS(SVGNS, 'rect')), 1,
'Unreferenced rect left in defs' )
class DoNotRemoveChainedRefsInDefs(unittest.TestCase):
def runTest(self):
doc = scour.scourXmlFile('unittests/refs-in-defs.svg')
g = doc.getElementsByTagNameNS(SVGNS, 'g')[0]
self.assertEquals( g.childNodes.length >= 2, True,
'Chained references not honored in defs' )
class KeepTitleInDefs(unittest.TestCase):
def runTest(self):
doc = scour.scourXmlFile('unittests/referenced-elements-1.svg')
@ -975,7 +982,8 @@ class EnsureLineEndings(unittest.TestCase):
s = scour.scourString(open('unittests/whitespace-important.svg').read())
self.assertEquals( len(s.splitlines()), 4,
'Did not output line ending character correctly')
# TODO: write tests for --enable-viewboxing
# TODO; write a test for embedding rasters
# TODO: write a test for --disable-embed-rasters
# TODO: write tests for --keep-editor-data