From e6d9a1e65522f859e0ce65bd1f3e476f6e663f33 Mon Sep 17 00:00:00 2001 From: Niels Thykier Date: Sat, 18 Aug 2018 16:27:33 +0000 Subject: [PATCH] Add test case for #203 Signed-off-by: Niels Thykier --- testscour.py | 14 ++++++++++++++ ...ve-duplicate-gradients-master-without-id.svg | 17 +++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 unittests/remove-duplicate-gradients-master-without-id.svg diff --git a/testscour.py b/testscour.py index 04da38c..b2f24e6 100755 --- a/testscour.py +++ b/testscour.py @@ -1401,6 +1401,20 @@ class RemoveDuplicateRadialGradients(unittest.TestCase): 'Duplicate radial gradient not removed') +class RemoveDuplicateRadialGradientsEnsureMasterHasID(unittest.TestCase): + + def runTest(self): + svgdoc = scourXmlFile('unittests/remove-duplicate-gradients-master-without-id.svg') + lingrads = svgdoc.getElementsByTagNameNS(SVGNS, 'linearGradient') + rect = svgdoc.getElementById('r1') + self.assertEqual(1, lingrads.length, + 'Duplicate linearGradient not removed') + self.assertEqual(lingrads[0].getAttribute("id"), "g1", + "linearGradient has a proper ID") + self.assertNotEqual(rect.getAttribute("fill"), "url(#)", + "linearGradient has a proper ID") + + class RereferenceForRadialGradient(unittest.TestCase): def runTest(self): diff --git a/unittests/remove-duplicate-gradients-master-without-id.svg b/unittests/remove-duplicate-gradients-master-without-id.svg new file mode 100644 index 0000000..66727e9 --- /dev/null +++ b/unittests/remove-duplicate-gradients-master-without-id.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + +