jonathan: thuban/test test_baserenderer.py, 1.9, 1.10 test_layer.py, 1.33, 1.34 test_load.py, 1.44, 1.45 test_save.py, 1.34, 1.35 test_load_1_0_1.py, 1.1, NONE

cvs@intevation.de cvs at intevation.de
Fri Jan 28 16:54:02 CET 2005


Author: jonathan

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

Modified Files:
	test_baserenderer.py test_layer.py test_load.py test_save.py 
Removed Files:
	test_load_1_0_1.py 
Log Message:
Make layer's use_mask flag default to true. Support a bit array describing
the mask to use. Improve error handling in ProjectRasterFile (also addresses
RT #2947).


Index: test_baserenderer.py
===================================================================
RCS file: /thubanrepository/thuban/test/test_baserenderer.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- test_baserenderer.py	27 Jan 2005 14:19:41 -0000	1.9
+++ test_baserenderer.py	28 Jan 2005 15:54:00 -0000	1.10
@@ -287,12 +287,12 @@
 
         # The following commented out code block can be used to generate
         # the base64 coded reference image data
-        #hexed = binascii.b2a_base64(renderer.raster_data[2])
+        #hexed = binascii.b2a_base64(renderer.raster_data[2][1])
         #while hexed:
             #print repr(hexed[:65])
             #hexed = hexed[65:]
 
-        # The reference data as a base64 coded BMP image
+        # The reference data as a base64 coded RAW image
         raw_data = binascii.a2b_base64(
             'UmbmUmbmUmbmUmbmUmbmAtYCJooCAtICAq4CJooCArICAuICArICAuYCAs4COn4CO'
             'n4CAq4CAuICFpICUmbmUmbmUmbmUmbmUmbmUmbmUmbmUmbmAuYCAqICAqoCAqoCFp'
@@ -319,7 +319,11 @@
             'bmUmbmUmbmUmbmUmbmUmbmUmbmUmbmUmbmUmbmUmbmUmbmUmbmUmbmUmbmUmbmUmb'
             'mUmbmUmbmUmbmUmbmUmbmUmbmUmbmUmbmUmbmUmbmUmbmUmbmUmbmUmbmUmbmUmbm'
             'UmbmUmbmUmbmUmbmUmbmUmbmUmbmUmbmUmbmUmbm\n')
-        self.assertEquals(renderer.raster_data, (20,20,(raw_data, None)))
+
+        raw_mask = binascii.a2b_base64(
+            'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
+            'AAAAAAAAAAAAAAA\n')
+        self.assertEquals(renderer.raster_data, (20,20,(raw_data, raw_mask)))
         self.assertEquals(renderer.raster_format, "RAW")
 
         self.assertEquals(dc.calls,

Index: test_layer.py
===================================================================
RCS file: /thubanrepository/thuban/test/test_layer.py,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- test_layer.py	27 Jan 2005 14:19:41 -0000	1.33
+++ test_layer.py	28 Jan 2005 15:54:00 -0000	1.34
@@ -231,7 +231,7 @@
         layer = RasterLayer("Test RasterLayer", filename)
         self.failIf(layer.HasClassification())
         self.failIf(layer.HasShapes())
-        self.failIf(layer.UseMask())
+        self.failUnless(layer.UseMask())
         self.assertEquals(layer.GetImageFilename(), os.path.abspath(filename))
         self.assertFloatSeqEqual(layer.BoundingBox(),
                                  [-24.5500000, 63.2833330,
@@ -460,27 +460,28 @@
         layer.Subscribe(LAYER_CHANGED, self.subscribe_with_params,
                         LAYER_CHANGED)
 
-        self.failIf(layer.UseMask())
-
-        layer.SetUseMask(True)
         self.failUnless(layer.UseMask())
+
+        layer.SetUseMask(False)
+        self.failIf(layer.UseMask())
         self.check_messages([(layer, LAYER_CHANGED)])
         self.clear_messages()
 
-        layer.SetUseMask(True)
-        self.failUnless(layer.UseMask())
+        layer.SetUseMask(False)
+        self.failIf(layer.UseMask())
         self.check_messages([])
         self.clear_messages()
 
-        layer.SetUseMask(False)
-        self.failIf(layer.UseMask())
+        layer.SetUseMask(True)
+        self.failUnless(layer.UseMask())
         self.check_messages([(layer, LAYER_CHANGED)])
         self.clear_messages()
 
-        layer.SetUseMask(False)
-        self.failIf(layer.UseMask())
+        layer.SetUseMask(True)
+        self.failUnless(layer.UseMask())
         self.check_messages([])
         self.clear_messages()
+
 
 if __name__ == "__main__":
     support.run_tests()

Index: test_load.py
===================================================================
RCS file: /thubanrepository/thuban/test/test_load.py,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- test_load.py	27 Jan 2005 14:19:41 -0000	1.44
+++ test_load.py	28 Jan 2005 15:54:00 -0000	1.45
@@ -663,7 +663,7 @@
 <session xmlns="http://thuban.intevation.org/dtds/thuban-1.1-dev.dtd"
         title="single map&amp;layer">
     <map title="Test Map">
-        <rasterlayer visible="false" use_mask="true" filename="../../Data/iceland/island.tif"
+        <rasterlayer visible="false" filename="../../Data/iceland/island.tif"
                 title="My RasterLayer"/>
     </map>
 </session>
@@ -679,8 +679,6 @@
         map = self.session.Maps()[0] # only one map in the sample
 
         layer = map.Layers()[0] # one layer in the sample
-
-        layer.SetUseMask(True)
 
         eq(layer.Title(), "My RasterLayer")
         self.failIf(layer.Visible())

Index: test_save.py
===================================================================
RCS file: /thubanrepository/thuban/test/test_save.py,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- test_save.py	27 Jan 2005 14:19:41 -0000	1.34
+++ test_save.py	28 Jan 2005 15:54:00 -0000	1.35
@@ -242,7 +242,6 @@
         imgfile = os.path.join(os.path.dirname(__file__),
                                os.pardir, "Data", "iceland", "island.tif")
         layer = RasterLayer("My RasterLayer", imgfile)
-        layer.SetUseMask(True)
         map.AddLayer(layer)
 
         filename = self.temp_file_name("%s.thuban" % self.id())
@@ -259,7 +258,7 @@
             <map title="Test Map">
                 <rasterlayer title="My RasterLayer"
                         filename="../../Data/iceland/island.tif"
-                        visible="true" use_mask="true">
+                        visible="true">
                 </rasterlayer>
             </map>
         </session>'''

--- test_load_1_0_1.py DELETED ---





More information about the Thuban-devel mailing list

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