Added Adobe namespaced elements unit test
This commit is contained in:
parent
339d04f659
commit
ab4fe686fe
2 changed files with 56 additions and 4 deletions
29
testscour.py
29
testscour.py
|
|
@ -34,15 +34,36 @@ def walkTree(elem, func):
|
|||
|
||||
class NoInkscapeElements(unittest.TestCase):
|
||||
def runTest(self):
|
||||
self.assertNotEquals(walkTree( scour.scourXmlFile('unittests/sodipodi.svg').documentElement,
|
||||
lambda e: e.namespaceURI != "http://www.inkscape.org/namespaces/inkscape" ), False,
|
||||
self.assertNotEquals(walkTree(scour.scourXmlFile('unittests/sodipodi.svg').documentElement,
|
||||
lambda e: e.namespaceURI != 'http://www.inkscape.org/namespaces/inkscape'), False,
|
||||
'Found Inkscape elements' )
|
||||
|
||||
class NoSodipodiElements(unittest.TestCase):
|
||||
def runTest(self):
|
||||
self.assertNotEquals(walkTree( scour.scourXmlFile('unittests/sodipodi.svg').documentElement,
|
||||
lambda e: e.namespaceURI != "http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" ), False,
|
||||
self.assertNotEquals(walkTree(scour.scourXmlFile('unittests/sodipodi.svg').documentElement,
|
||||
lambda e: e.namespaceURI != 'http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd'), False,
|
||||
'Found Sodipodi elements' )
|
||||
|
||||
class NoAdobeElements(unittest.TestCase):
|
||||
def runTest(self):
|
||||
self.assertNotEquals(walkTree(scour.scourXmlFile('unittests/adobe.svg').documentElement,
|
||||
lambda e: e.namespaceURI != 'http://ns.adobe.com/AdobeIllustrator/10.0/'), False,
|
||||
'Found Adobe Illustrator elements' )
|
||||
self.assertNotEquals(walkTree(scour.scourXmlFile('unittests/adobe.svg').documentElement,
|
||||
lambda e: e.namespaceURI != 'http://ns.adobe.com/Graphs/1.0/'), False,
|
||||
'Found Adobe Graphs elements' )
|
||||
self.assertNotEquals(walkTree(scour.scourXmlFile('unittests/adobe.svg').documentElement,
|
||||
lambda e: e.namespaceURI != 'http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/'), False,
|
||||
'Found Adobe SVG Viewer elements' )
|
||||
self.assertNotEquals(walkTree(scour.scourXmlFile('unittests/adobe.svg').documentElement,
|
||||
lambda e: e.namespaceURI != 'http://ns.adobe.com/Variables/1.0/'), False,
|
||||
'Found Adobe Variables elements' )
|
||||
self.assertNotEquals(walkTree(scour.scourXmlFile('unittests/adobe.svg').documentElement,
|
||||
lambda e: e.namespaceURI != 'http://ns.adobe.com/SaveForWeb/1.0/'), False,
|
||||
'Found Adobe Save For Web elements' )
|
||||
self.assertNotEquals(walkTree(scour.scourXmlFile('unittests/adobe.svg').documentElement,
|
||||
lambda e: e.namespaceURI != 'http://ns.adobe.com/Extensibility/1.0/'), False,
|
||||
'Found Adobe Extensibility elements' )
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
|
|||
31
unittests/adobe.svg
Normal file
31
unittests/adobe.svg
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generator: Adobe Illustrator 10.0.3, SVG Export Plug-In . SVG Version: 3.0.0 Build 77) -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd" [
|
||||
<!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
|
||||
<!ENTITY ns_extend "http://ns.adobe.com/Extensibility/1.0/">
|
||||
<!ENTITY ns_ai "http://ns.adobe.com/AdobeIllustrator/10.0/">
|
||||
<!ENTITY ns_graphs "http://ns.adobe.com/Graphs/1.0/">
|
||||
<!ENTITY ns_vars "http://ns.adobe.com/Variables/1.0/">
|
||||
<!ENTITY ns_imrep "http://ns.adobe.com/ImageReplacement/1.0/">
|
||||
<!ENTITY ns_sfw "http://ns.adobe.com/SaveForWeb/1.0/">
|
||||
<!ENTITY ns_custom "http://ns.adobe.com/GenericCustomNamespace/1.0/">
|
||||
<!ENTITY ns_adobe_xpath "http://ns.adobe.com/XPath/1.0/">
|
||||
<!ENTITY ns_svg "http://www.w3.org/2000/svg">
|
||||
<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
|
||||
]>
|
||||
<svg xmlns:x="http://ns.adobe.com/Extensibility/1.0/" xmlns:i="http://ns.adobe.com/AdobeIllustrator/10.0/" xmlns:graph="http://ns.adobe.com/Graphs/1.0/" i:viewOrigin="190.2959 599.1841" i:rulerOrigin="0 0" i:pageBounds="0 792 612 0" xmlns="http://www.w3.org/2000/svg" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/">
|
||||
<x:foo>bar</x:foo>
|
||||
<i:foo>bar</i:foo>
|
||||
<graph:foo>bar</graph:foo>
|
||||
<a:foo>bar</a:foo>
|
||||
<variableSets xmlns="http://ns.adobe.com/Variables/1.0/">
|
||||
<variableSet varSetName="binding1" locked="none">
|
||||
<variables/>
|
||||
<v:sampleDataSets xmlns="http://ns.adobe.com/GenericCustomNamespace/1.0/" xmlns:v="http://ns.adobe.com/Variables/1.0/"/>
|
||||
</variableSet>
|
||||
</variableSets>
|
||||
<sfw xmlns="http://ns.adobe.com/SaveForWeb/1.0/">
|
||||
<slices/>
|
||||
<sliceSourceBounds y="191.664" x="190.296" width="225.72" height="407.52" bottomLeftOrigin="true"/>
|
||||
</sfw>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.7 KiB |
Loading…
Add table
Add a link
Reference in a new issue