Merge pull request #187 from nthykier/fix-gh-186-shorten-id-recycle-used-ids

Enable shortenIDs to recycle existing IDs
This commit is contained in:
Patrick Storz 2020-05-17 16:48:18 +02:00 committed by GitHub
commit 4fe2655f86
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 141 additions and 46 deletions

View file

@ -2045,6 +2045,19 @@ class ShortenIDsOption(unittest.TestCase):
'Did not update reference to shortened ID')
class ShortenIDsStableOutput(unittest.TestCase):
def runTest(self):
doc = scourXmlFile('unittests/shorten-ids-stable-output.svg',
parse_args(['--shorten-ids']))
use_tags = doc.getElementsByTagName('use')
hrefs_ordered = [x.getAttributeNS('http://www.w3.org/1999/xlink', 'href')
for x in use_tags]
expected = ['#a', '#b', '#b']
self.assertEquals(hrefs_ordered, expected,
'--shorten-ids pointlessly reassigned ids')
class MustKeepGInSwitch(unittest.TestCase):
def runTest(self):