From c3982e28df6d216c9400e9a25a905fe73302976e Mon Sep 17 00:00:00 2001 From: Cynthia Gauthier Date: Wed, 16 Jun 2010 03:49:46 -0400 Subject: [PATCH] Add unit tests for requiring a in a if the original file has one. --- testscour.py | 13 +++++++++++++ unittests/groups-in-switch-with-id.svg | 18 ++++++++++++++++++ unittests/groups-in-switch.svg | 18 ++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 unittests/groups-in-switch-with-id.svg create mode 100644 unittests/groups-in-switch.svg diff --git a/testscour.py b/testscour.py index d696c99..1213951 100755 --- a/testscour.py +++ b/testscour.py @@ -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 in a ') + +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 in a ') + # TODO: write tests for --enable-viewboxing # TODO; write a test for embedding rasters diff --git a/unittests/groups-in-switch-with-id.svg b/unittests/groups-in-switch-with-id.svg new file mode 100644 index 0000000..dd4f90a --- /dev/null +++ b/unittests/groups-in-switch-with-id.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/unittests/groups-in-switch.svg b/unittests/groups-in-switch.svg new file mode 100644 index 0000000..0c1fd06 --- /dev/null +++ b/unittests/groups-in-switch.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + \ No newline at end of file