Add unit tests for requiring a <g> in a <switch> if the original file has one.

This commit is contained in:
Cynthia Gauthier 2010-06-16 03:49:46 -04:00
parent bb1a38a7ad
commit c3982e28df
3 changed files with 49 additions and 0 deletions

View file

@ -1062,6 +1062,19 @@ class ShortenIDsOption(unittest.TestCase):
self.assertEquals(rectTag.getAttribute('fill'), 'url(#a)',
'Did not update reference to shortened ID')
class MustKeepGInSwitch(unittest.TestCase):
def runTest(self):
doc = scour.scourXmlFile('unittests/groups-in-switch.svg')
self.assertEquals(doc.getElementsByTagName('g').length, 1,
'Erroneously removed a <g> in a <switch>')
class MustKeepGInSwitch2(unittest.TestCase):
def runTest(self):
doc = scour.scourXmlFile('unittests/groups-in-switch-with-id.svg',
scour.parse_args(['--enable-id-stripping'])[0])
self.assertEquals(doc.getElementsByTagName('g').length, 1,
'Erroneously removed a <g> in a <switch>')
# TODO: write tests for --enable-viewboxing
# TODO; write a test for embedding rasters