jonathan: thuban/test test_baserenderer.py, 1.10, 1.11 test_layer.py, 1.34, 1.35
cvs@intevation.de
cvs at intevation.de
Wed Feb 16 22:14:49 CET 2005
- Previous message: jonathan: thuban/libraries/thuban swigPtrConvertHack.h, NONE, 1.1 wxPython_int.h, NONE, 1.1 gdalwarp.cpp, 1.6, 1.7 wxproj.cpp, 1.4, 1.5
- Next message: jonathan: thuban/test test_baserenderer.py, 1.10, 1.11 test_layer.py, 1.34, 1.35
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: jonathan
Update of /thubanrepository/thuban/test
In directory doto:/tmp/cvs-serv7505/test
Modified Files:
test_baserenderer.py test_layer.py
Log Message:
Further wxPython 2.5 changes using patches from Daniel Calvelo Aros
so that that wxproj doesn't crash. Added GUI support for selecting
alpha channel (opacity can't be selected yet).
Index: test_baserenderer.py
===================================================================
RCS file: /thubanrepository/thuban/test/test_baserenderer.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- test_baserenderer.py 28 Jan 2005 15:54:00 -0000 1.10
+++ test_baserenderer.py 16 Feb 2005 21:14:47 -0000 1.11
@@ -32,6 +32,7 @@
from Thuban.UI.baserenderer import BaseRenderer, \
add_renderer_extension, init_renderer_extensions
+from Thuban.version import versions
class MockDC:
@@ -287,7 +288,7 @@
# 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][1])
+ #hexed = binascii.b2a_base64(renderer.raster_data[2][0])
#while hexed:
#print repr(hexed[:65])
#hexed = hexed[65:]
@@ -320,16 +321,58 @@
'mUmbmUmbmUmbmUmbmUmbmUmbmUmbmUmbmUmbmUmbmUmbmUmbmUmbmUmbmUmbmUmbm'
'UmbmUmbmUmbmUmbmUmbmUmbmUmbmUmbmUmbmUmbm\n')
- raw_mask = binascii.a2b_base64(
- 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
- 'AAAAAAAAAAAAAAA\n')
- self.assertEquals(renderer.raster_data, (20,20,(raw_data, raw_mask)))
+ #print
+ #hexed = binascii.b2a_base64(renderer.raster_data[2][1])
+ #while hexed:
+ #print repr(hexed[:61])
+ #hexed = hexed[61:]
+
+
+ if versions['wxPython-tuple'] < (2,5,3):
+ raw_mask = binascii.a2b_base64(
+ 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
+ 'AAAAAAAAAAAAAAAAAAA\n')
+ else:
+ raw_mask = binascii.a2b_base64(
+ '//8P//8P//8P//8P//8P//8P//8P//8P//8P//8P//8P//8P//8P//8P//8P/'
+ '/8P//8P//8P//8P//8P\n')
+
+ self.assertEquals(renderer.raster_data,
+ (20,20,(raw_data, raw_mask, None)))
+
self.assertEquals(renderer.raster_format, "RAW")
self.assertEquals(dc.calls,
[('BeginDrawing',),
('SetFont', "label font"),
('EndDrawing',)])
+
+ if versions['wxPython-tuple'] >= (2,5,3):
+ layer.SetMaskType(layer.MASK_ALPHA)
+ renderer.render_map()
+
+ #print
+ #hexed = binascii.b2a_base64(renderer.raster_data[2][2])
+ #while hexed:
+ #print repr(hexed[:61])
+ #hexed = hexed[61:]
+ raw_alpha = binascii.a2b_base64(
+ '/////////////////////////////////////////////////////////////'
+ '/////////////////////////////////////////////////////////////'
+ '/////////////////////////////////////////////////////////////'
+ '/////////////////////////////////////////////////////////////'
+ '/////////////////////////////////////////////////////////////'
+ '/////////////////////////////////////////////////////////////'
+ '/////////////////////////////////////////////////////////////'
+ '/////////////////////////////////////////////////////////////'
+ '/////////////////////////////////////////////w==\n')
+ self.assertEquals(renderer.raster_data,
+ (20,20,(raw_data, None, raw_alpha)))
+
+
+ layer.SetMaskType(layer.MASK_NONE)
+ renderer.render_map()
+ self.assertEquals(renderer.raster_data, (20,20,(raw_data, None, None)))
def test_point_map_projection(self):
"""Test BaseRenderer with point layer and map projection"""
Index: test_layer.py
===================================================================
RCS file: /thubanrepository/thuban/test/test_layer.py,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- test_layer.py 28 Jan 2005 15:54:00 -0000 1.34
+++ test_layer.py 16 Feb 2005 21:14:47 -0000 1.35
@@ -231,7 +231,7 @@
layer = RasterLayer("Test RasterLayer", filename)
self.failIf(layer.HasClassification())
self.failIf(layer.HasShapes())
- self.failUnless(layer.UseMask())
+ self.assertEquals(layer.MaskType(), layer.MASK_BIT)
self.assertEquals(layer.GetImageFilename(), os.path.abspath(filename))
self.assertFloatSeqEqual(layer.BoundingBox(),
[-24.5500000, 63.2833330,
@@ -460,27 +460,46 @@
layer.Subscribe(LAYER_CHANGED, self.subscribe_with_params,
LAYER_CHANGED)
- self.failUnless(layer.UseMask())
+ self.assertEquals(layer.MaskType(), layer.MASK_BIT)
- layer.SetUseMask(False)
- self.failIf(layer.UseMask())
+ layer.SetMaskType(layer.MASK_NONE)
+ self.failIf(layer.MaskType() != layer.MASK_NONE)
self.check_messages([(layer, LAYER_CHANGED)])
self.clear_messages()
- layer.SetUseMask(False)
- self.failIf(layer.UseMask())
+ layer.SetMaskType(layer.MASK_NONE)
+ self.failIf(layer.MaskType() != layer.MASK_NONE)
self.check_messages([])
self.clear_messages()
- layer.SetUseMask(True)
- self.failUnless(layer.UseMask())
+ layer.SetMaskType(layer.MASK_BIT)
+ self.failIf(layer.MaskType() != layer.MASK_BIT)
self.check_messages([(layer, LAYER_CHANGED)])
self.clear_messages()
- layer.SetUseMask(True)
- self.failUnless(layer.UseMask())
+ layer.SetMaskType(layer.MASK_BIT)
+ self.failIf(layer.MaskType() != layer.MASK_BIT)
self.check_messages([])
self.clear_messages()
+
+ layer.SetMaskType(layer.MASK_ALPHA)
+ self.failIf(layer.MaskType() != layer.MASK_ALPHA)
+
+ layer.SetAlphaOpacity(0)
+ self.assertEquals(layer.AlphaOpacity(), 0)
+ layer.SetAlphaOpacity(0.5)
+ self.assertEquals(layer.AlphaOpacity(), 0.5)
+ layer.SetAlphaOpacity(1)
+ self.assertEquals(layer.AlphaOpacity(), 1)
+
+ self.assertRaises(ValueError, layer.SetAlphaOpacity, -0.1)
+ self.assertRaises(ValueError, layer.SetAlphaOpacity, 1.1)
+
+ layer.SetMaskType(layer.MASK_NONE)
+ self.assertEquals(layer.AlphaOpacity(), None)
+
+ self.assertRaises(ValueError, layer.SetMaskType, -1)
+ self.assertRaises(ValueError, layer.SetMaskType, 4)
if __name__ == "__main__":
- Previous message: jonathan: thuban/libraries/thuban swigPtrConvertHack.h, NONE, 1.1 wxPython_int.h, NONE, 1.1 gdalwarp.cpp, 1.6, 1.7 wxproj.cpp, 1.4, 1.5
- Next message: jonathan: thuban/test test_baserenderer.py, 1.10, 1.11 test_layer.py, 1.34, 1.35
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Thuban-devel
mailing list
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)