Add test case for #198/#202
Signed-off-by: Niels Thykier <niels@thykier.net>
This commit is contained in:
parent
6846e0c9ee
commit
58b75c314a
2 changed files with 27 additions and 0 deletions
14
testscour.py
14
testscour.py
|
|
@ -891,6 +891,20 @@ class DoNotCollapseMultiplyReferencedGradients(unittest.TestCase):
|
|||
'Multiply-referenced linear gradient collapsed')
|
||||
|
||||
|
||||
class PreserveXLinkHrefWhenCollapsingReferencedGradients(unittest.TestCase):
|
||||
|
||||
def runTest(self):
|
||||
doc = scourXmlFile('unittests/collapse-gradients-preserve-xlink-href.svg')
|
||||
g1 = doc.getElementById("g1")
|
||||
g2 = doc.getElementById("g2")
|
||||
g3 = doc.getElementById("g3")
|
||||
self.assertTrue(g1, 'g1 is still present')
|
||||
self.assertTrue(g2 is None, 'g2 was removed')
|
||||
self.assertTrue(g3, 'g3 is still present')
|
||||
self.assertEqual(g3.getAttributeNS('http://www.w3.org/1999/xlink', 'href'), '#g1',
|
||||
'g3 has a xlink:href to g1')
|
||||
|
||||
|
||||
class RemoveTrailingZerosFromPath(unittest.TestCase):
|
||||
|
||||
def runTest(self):
|
||||
|
|
|
|||
13
unittests/collapse-gradients-preserve-xlink-href.svg
Normal file
13
unittests/collapse-gradients-preserve-xlink-href.svg
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?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">
|
||||
<defs>
|
||||
<linearGradient id="g1" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse">
|
||||
<stop offset="0" stop-color="blue" />
|
||||
<stop offset="1" stop-color="yellow" />
|
||||
</linearGradient>
|
||||
<radialGradient id="g2" xlink:href="#g1" cx="100" cy="100" r="70"/>
|
||||
<radialGradient id="g3" xlink:href="#g2" cx="100" cy="100" r="70"/>
|
||||
</defs>
|
||||
<rect fill="url(#g1)" width="200" height="200"/>
|
||||
<rect fill="url(#g3)" width="200" height="200" y="200"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 599 B |
Loading…
Add table
Add a link
Reference in a new issue