Add test case for #203
Signed-off-by: Niels Thykier <niels@thykier.net>
This commit is contained in:
parent
d7d7dfb5be
commit
e6d9a1e655
2 changed files with 31 additions and 0 deletions
14
testscour.py
14
testscour.py
|
|
@ -1401,6 +1401,20 @@ class RemoveDuplicateRadialGradients(unittest.TestCase):
|
||||||
'Duplicate radial gradient not removed')
|
'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):
|
class RereferenceForRadialGradient(unittest.TestCase):
|
||||||
|
|
||||||
def runTest(self):
|
def runTest(self):
|
||||||
|
|
|
||||||
17
unittests/remove-duplicate-gradients-master-without-id.svg
Normal file
17
unittests/remove-duplicate-gradients-master-without-id.svg
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||||
|
<linearGradient x1="0" y1="0" x2="1" y2="1">
|
||||||
|
<stop offset="0" stop-color="red"/>
|
||||||
|
<stop offset="1" stop-color="blue"/>
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient id='g1' x1='0' y1='0' x2='1' y2='1'>
|
||||||
|
<stop offset='0' stop-color='red'/>
|
||||||
|
<stop offset='1' stop-color='blue'/>
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient x1='0' y1='0' x2='1' y2='1'>
|
||||||
|
<stop offset='0' stop-color='red'/>
|
||||||
|
<stop offset='1' stop-color='blue'/>
|
||||||
|
</linearGradient>
|
||||||
|
|
||||||
|
<rect id="r1" fill="url(#g1)" width="100" height="100"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 639 B |
Loading…
Add table
Add a link
Reference in a new issue