Only attempt to group elements that the content model allows to be children of a <g> when --create-groups is specified. (#98)

(before it could happen that e.g. `tspan` elements were grouped, which is invalid; fixes issues #96 and #97)
This commit is contained in:
Eduard Braun 2016-08-29 02:33:13 +02:00 committed by GitHub
parent 419f41cb48
commit 5844076258
4 changed files with 35 additions and 1 deletions

View file

@ -1222,6 +1222,13 @@ class GroupNoCreation(unittest.TestCase):
self.assertEqual(doc.getElementsByTagName('g').length, 0,
'Created a <g> for a run of elements having dissimilar attributes')
class GroupNoCreationForTspan(unittest.TestCase):
def runTest(self):
doc = scour.scourXmlFile('unittests/group-no-creation-tspan.svg',
scour.parse_args(['--create-groups']))
self.assertEqual(doc.getElementsByTagName('g').length, 0,
'Created a <g> for a run of <tspan>s that are not allowed as children according to content model')
class DoNotCommonizeAttributesOnReferencedElements(unittest.TestCase):
def runTest(self):
doc = scour.scourXmlFile('unittests/commonized-referenced-elements.svg')