Fix Bug 361817: wrong shebang line. Added tests for removing duplicate gradient stops and useless nested groups (neither of which pass yet)
This commit is contained in:
parent
359c42166f
commit
747a282f5f
3 changed files with 24 additions and 9 deletions
10
scour.py
10
scour.py
|
|
@ -1,6 +1,7 @@
|
|||
#!/usr/local/bin/python
|
||||
#!/usr/bin/env python
|
||||
|
||||
# Scour
|
||||
# Version 0.07
|
||||
# Version 0.08
|
||||
#
|
||||
# Copyright 2009 Jeff Schiller
|
||||
#
|
||||
|
|
@ -47,9 +48,8 @@
|
|||
# * Collapse all group based transformations
|
||||
|
||||
# Next Up:
|
||||
# - Remove duplicate gradient stops
|
||||
# - Remove unnecessary nested <g> elements
|
||||
# - Pretty up whitespace nodes on output
|
||||
# - Remove duplicate gradient stops
|
||||
# - Convert all colors to #RRGGBB format
|
||||
# - rework command-line argument processing so that options are configurable
|
||||
# - remove unreferenced patterns? https://bugs.edge.launchpad.net/ubuntu/+source/human-icon-theme/+bug/361667/
|
||||
|
|
@ -69,7 +69,7 @@ import os.path
|
|||
import urllib
|
||||
|
||||
APP = 'scour'
|
||||
VER = '0.07'
|
||||
VER = '0.08'
|
||||
COPYRIGHT = 'Copyright Jeff Schiller, 2009'
|
||||
|
||||
NS = { 'SVG': 'http://www.w3.org/2000/svg',
|
||||
|
|
|
|||
15
testscour.py
15
testscour.py
|
|
@ -138,11 +138,18 @@ class RemoveUnreferencedRadialGradient(unittest.TestCase):
|
|||
self.assertEquals(len(doc.getElementsByTagNameNS('http://www.w3.org/2000/svg', 'radialradient')), 0,
|
||||
'Unreferenced radialGradient not removed' )
|
||||
|
||||
|
||||
# These tests will fail at present
|
||||
#class RemoveDuplicateGradientStops(unittest.TestCase):
|
||||
# def runTest(self):
|
||||
# doc = scour.scourXmlFile('unittests/duplicate-gradient-stops.svg')
|
||||
class RemoveUselessNestedGroups(unittest.TestCase):
|
||||
def runTest(self):
|
||||
doc = scour.scourXmlFile('unittests/nested-useless-groups.svg')
|
||||
self.assertEquals(len(doc.getElementsByTagNameNS('http://wwww.w3.org/2000/svg', 'g')), 1,
|
||||
'Useless nested groups not removed' )
|
||||
|
||||
class RemoveDuplicateGradientStops(unittest.TestCase):
|
||||
def runTest(self):
|
||||
doc = scour.scourXmlFile('unittests/duplicate-gradient-stops.svg')
|
||||
self.assertEquals(len(doc.getElementsByTagNameNS('http://www.w3.org/2000/svg', 'stop')), 3,
|
||||
'Duplicate gradient stops not removed' )
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
|
|||
8
unittests/nested-useless-groups.svg
Normal file
8
unittests/nested-useless-groups.svg
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<g>
|
||||
<g transform="translate(50,50)">
|
||||
<rect width="300" height="200" fill="green" />
|
||||
<circle cx="200" cy="100" r="50" fill="yellow" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 197 B |
Loading…
Add table
Add a link
Reference in a new issue