[Skencil-commits] r683 - in skencil/trunk: Plugins Plugins/Filters test

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Jun 7 00:33:47 CEST 2006


Author: bh
Date: 2006-06-07 00:33:46 +0200 (Wed, 07 Jun 2006)
New Revision: 683

Modified:
   skencil/trunk/Plugins/ChangeLog
   skencil/trunk/Plugins/Filters/svgsaver.py
   skencil/trunk/test/ChangeLog
   skencil/trunk/test/test_svg10_export.py
Log:
Add the svg namespace to the SVG files generated by the svgexport plugin

Modified: skencil/trunk/Plugins/ChangeLog
===================================================================
--- skencil/trunk/Plugins/ChangeLog	2006-06-05 18:35:01 UTC (rev 682)
+++ skencil/trunk/Plugins/ChangeLog	2006-06-06 22:33:46 UTC (rev 683)
@@ -1,3 +1,9 @@
+2006-06-07  Bernhard Herzog  <bh at intevation.de>
+
+	* Filters/svgsaver.py (SVGSaver.Save): Add a namespace attribute
+	so that other programs, e.g. Firefox, recognize the generated XML
+	as SVG.  Wald patch #50 by Fabian Dortu
+
 2006-02-12  Bernhard Herzog  <bh at intevation.de>
 
 	Fix some problems in the drawfile filter because of changes in the

Modified: skencil/trunk/Plugins/Filters/svgsaver.py
===================================================================
--- skencil/trunk/Plugins/Filters/svgsaver.py	2006-06-05 18:35:01 UTC (rev 682)
+++ skencil/trunk/Plugins/Filters/svgsaver.py	2006-06-06 22:33:46 UTC (rev 683)
@@ -1,5 +1,6 @@
 # Sketch - A Python-based interactive drawing program
-# Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 by Bernhard Herzog
+# Copyright (C) 2004, 2006 by Bernhard Herzog
+# Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003 by Bernhard Herzog
 # Part of the code for Arrow heads and text from Paul Giotta (2002)
 #
 # This library is free software; you can redistribute it and/or
@@ -260,7 +261,8 @@
         width = right - left
         height = top - bottom
         self.trafo = Trafo(1, 0, 0, -1, -left, top)
-        self.file.write('<svg width="%g" height="%g"' % (width, height))
+        self.file.write('<svg xmlns="http://www.w3.org/2000/svg"'
+                        ' width="%g" height="%g"' % (width, height))
         #self.file.write(' transform="matrix(%g,%g,%g,%g,%g,%g)">\n' % trafo)
         self.file.write('>\n')
 

Modified: skencil/trunk/test/ChangeLog
===================================================================
--- skencil/trunk/test/ChangeLog	2006-06-05 18:35:01 UTC (rev 682)
+++ skencil/trunk/test/ChangeLog	2006-06-06 22:33:46 UTC (rev 683)
@@ -1,3 +1,8 @@
+2006-06-07  Bernhard Herzog  <bh at intevation.de>
+
+	* test_svg10_export.py (TestSVGExport.test_svg_namespace): New
+	test to check svg namespace
+
 2006-03-05  Bernhard Herzog  <bh at intevation.de>
 
 	* test_tools.py (TestTools.setUp, TestTools.tearDown): Don't

Modified: skencil/trunk/test/test_svg10_export.py
===================================================================
--- skencil/trunk/test/test_svg10_export.py	2006-06-05 18:35:01 UTC (rev 682)
+++ skencil/trunk/test/test_svg10_export.py	2006-06-06 22:33:46 UTC (rev 683)
@@ -1,5 +1,5 @@
 # Sketch - A Python-based interactive drawing program
-# Copyright (C) 2003, 2004 by Bernhard Herzog
+# Copyright (C) 2003, 2004, 2006 by Bernhard Herzog
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Library General Public
@@ -127,6 +127,20 @@
         inpsrc.setByteStream(StringIO(testdata))
         self.assertEquals(sax_eventlist(filename), sax_eventlist(inpsrc))
 
+    def test_svg_namespace(self):
+        """Test whether Skencil includes the required namespace attributes"""
+        doc = Document(create_layer = 1)
+        self.to_destroy.append(doc)
+        filename = self.volatile_file_name("namespace.svg")
+        saver = plugins.find_export_plugin("SVG")
+        saver(doc, filename)
+        self.assertEquals(sax_eventlist(filename, accepted_elements=["svg"]),
+                          [('start', 'svg',
+                            [("height", "0"),
+                             ("width", "0"),
+                             ('xmlns', "http://www.w3.org/2000/svg")]),
+                           ('end', 'svg')])
+
     def test_text_with_outline(self):
         """Test SVG 1.0 export: document containing text with outline
 



More information about the Skencil-commits mailing list