Add unit tests for removing fill attributes when fill=none

This commit is contained in:
JSCHILL1 2009-04-24 09:42:23 -05:00
parent d9866c99e9
commit 0f1d0b104d
3 changed files with 18 additions and 0 deletions

View file

@ -44,6 +44,9 @@
# * Process quadratic Bezier curves
# * Collapse all group based transformations
# Suggestion from Richard Hutch:
# * Put id attributes first in the serialization (or make the d attribute last)
# Next Up:
# + fix bug when removing stroke styles
# - Convert all colors to #RRGGBB format

View file

@ -340,6 +340,18 @@ class RemoveStrokeDashoffsetWhenStrokeNone(unittest.TestCase):
self.assertEquals(doc.getElementsByTagNameNS(SVGNS, 'path')[0].getAttribute('stroke-dashoffset'), '',
"stroke-dashoffset attribute not emptied when no stroke" )
class RemoveFillRuleWhenFillNone(unittest.TestCase):
def runTest(self):
doc = scour.scourXmlFile('unittests/fill-none.svg')
self.assertEquals(doc.getElementsByTagNameNS(SVGNS, 'path')[0].getAttribute('fill-rule'), '',
"fill-rule attribute not emptied when no fill" )
class RemoveFillOpacityWhenFillNone(unittest.TestCase):
def runTest(self):
doc = scour.scourXmlFile('unittests/fill-none.svg')
self.assertEquals(doc.getElementsByTagNameNS(SVGNS, 'path')[0].getAttribute('fill-opacity'), '',
"fill-opacity attribute not emptied when no fill" )
#class RemoveUnreferencedFonts(unittest.TestCase):
# def runTest(self):
# doc = scour.scourXmlFile('unittests/unreferenced-font.svg')

3
unittests/fill-none.svg Normal file
View file

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg">
<path id="p" style="fill: none; fill-rule: evenodd; fill-opacity: 0.5;" d="M 7.7592046,36.982095 C 7.8831049,40.873696 7.8339808,45.305308 7.8339808,49.436888 Z" />
</svg>

After

Width:  |  Height:  |  Size: 217 B