jan: thuban/test test_load.py,1.38,1.39

cvs@intevation.de cvs at intevation.de
Sun Oct 3 22:49:26 CEST 2004


Author: jan

Update of /thubanrepository/thuban/test
In directory doto:/tmp/cvs-serv5266

Modified Files:
	test_load.py 
Log Message:
(ClassificationTest.TestLayers): Added SetSize in case
of a corresponding argument is given.
TestSymbolSize): New. Test the size attribute of cldata.


Index: test_load.py
===================================================================
RCS file: /thubanrepository/thuban/test/test_load.py,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- test_load.py	12 Mar 2004 12:19:15 -0000	1.38
+++ test_load.py	3 Oct 2004 20:49:24 -0000	1.39
@@ -162,6 +162,8 @@
                 props.SetLineWidth(data[CLASSES][i][GROUP_PROPS][1])
                 props.SetFill(
                     parse_color(data[CLASSES][i][GROUP_PROPS][2]))
+                if len(data[CLASSES][i][GROUP_PROPS]) > 3:
+                    props.SetSize(data[CLASSES][i][GROUP_PROPS][3])
 
                 if data[CLASSES][i][GROUP_TYPE] == "default":
                     g = ClassGroupDefault(props, data[CLASSES][i][GROUP_LABEL])
@@ -384,6 +386,53 @@
         layer = layers[0]
 
         eq(layer.Visible(), False)
+
+        self.check_format()
+
+
+class TestSymbolSize(ClassificationTest):
+
+    file_contents = '''\
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE session SYSTEM "thuban-1.1.dtd">
+<session xmlns="http://thuban.intevation.org/dtds/thuban-1.1-dev.dtd" title="Thuban sample session">
+    <fileshapesource filetype="shapefile" id="D813968480" filename="../../Data/iceland/cultural_landmark-point.shp"/>
+    <map title="Iceland map">
+        <layer title="cultural_landmark-point" stroke_width="1" shapestore="D813968480" visible="true" stroke="#000000" fill="#000000">
+            <classification field="CLPTLABEL" field_type="string">
+                <clnull label="">
+                    <cldata stroke="#000000" stroke_width="1" size="3" fill="#000000"/>
+                </clnull>
+                <clpoint label="" value="RUINS">
+                    <cldata stroke="#000000" stroke_width="1" size="6" fill="#ffffff"/>
+                </clpoint>
+                <clpoint label="" value="FARM">
+                    <cldata stroke="#000000" stroke_width="1" size="9" fill="#ffff00"/>
+                </clpoint>
+            </classification>
+        </layer>
+    </map>
+</session>
+'''
+
+    def test(self):
+        """Test that the size attribute for point symbols is correctly
+        loaded for a layer."""
+        eq = self.assertEquals
+        session = load_session(self.filename())
+        self.session = session
+
+        map = session.Maps()[0] # only one map in the sample
+
+        expected = [("cultural_landmark-point", 2,
+                        [("default", (), "",
+                            ("#000000", 1, "#000000", 3)),
+                         ("single", "RUINS", "",
+                            ("#000000", 1, "#ffffff", 6)),
+                         ("single", "FARM", "",
+                            ("#000000", 1, "#ffff00", 9))])]
+
+        self.TestLayers(map.Layers(), expected)
 
         self.check_format()
 





More information about the Thuban-devel mailing list

This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)