/[thuban]/branches/WIP-pyshapelib-bramz/test/test_layer.py
ViewVC logotype

Diff of /branches/WIP-pyshapelib-bramz/test/test_layer.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1987 by bh, Fri Nov 28 11:37:35 2003 UTC revision 2339 by silke, Fri Aug 20 16:59:21 2004 UTC
# Line 1  Line 1 
1  # Copyright (c) 2002, 2003 by Intevation GmbH  # Copyright (c) 2002, 2003, 2004 by Intevation GmbH
2  # Authors:  # Authors:
3  # Bernhard Herzog <[email protected]>  # Bernhard Herzog <[email protected]>
4  #  #
# Line 190  class TestLayer(unittest.TestCase, suppo Line 190  class TestLayer(unittest.TestCase, suppo
190          self.assertFloatSeqEqual(layer.ShapesBoundingBox([0]),          self.assertFloatSeqEqual(layer.ShapesBoundingBox([0]),
191                                   (90.0, -8.90043373, 120, 11.1616263))                                   (90.0, -8.90043373, 120, 11.1616263))
192    
193            self.assertFloatSeqEqual(layer.ClipBoundingBox((-180, -6, 100, +120)),
194                                    (90.0, -6, 100, 11.1616263))
195            shapes = layer.ShapesInRegion((-180, -170, 200, +120))
196            print "Shapes", shapes
197            self.assertEquals([s.ShapeID() for s in shapes],[0])
198    
199      def test_empty_layer(self):      def test_empty_layer(self):
200          """Test Layer with empty shape file"""          """Test Layer with empty shape file"""
201          # create an empty shape file          # create an empty shape file
# Line 355  class TestLayerModification(unittest.Tes Line 361  class TestLayerModification(unittest.Tes
361          """          """
362          self.clear_messages()          self.clear_messages()
363          self.session = Session("Test session for %s" % self.__class__)          self.session = Session("Test session for %s" % self.__class__)
364          filename = os.path.join("..", "Data", "iceland", "political.shp")          self.filename = os.path.join("..", "Data", "iceland", "political.shp")
365          self.layer = Layer("Test Layer",          self.layer = Layer("Test Layer",
366                             self.session.OpenShapefile(filename))                             self.session.OpenShapefile(self.filename))
367          self.layer.Subscribe(LAYER_LEGEND_CHANGED, self.subscribe_with_params,          self.layer.Subscribe(LAYER_LEGEND_CHANGED, self.subscribe_with_params,
368                               LAYER_LEGEND_CHANGED)                               LAYER_LEGEND_CHANGED)
369          self.layer.Subscribe(LAYER_VISIBILITY_CHANGED,          self.layer.Subscribe(LAYER_VISIBILITY_CHANGED,
# Line 416  class TestLayerModification(unittest.Tes Line 422  class TestLayerModification(unittest.Tes
422          self.failUnless(self.layer.WasModified())          self.failUnless(self.layer.WasModified())
423    
424    
425  #      def test_tree_info(self):
426  # the tree info now contains Color objects which are difficult to test          """Test Layer.TreeInfo"""
427  #          self.assertEquals(self.layer.TreeInfo(),
428  #   def test_tree_info(self):                            ("Layer 'Test Layer'",
429  #       """Test Layer.TreeInfo"""                             ['Filename: %s' % os.path.abspath(self.filename),
430  #       self.assertEquals(self.layer.TreeInfo(),                              'Shown',
431  #                         ("Layer 'Test Layer'",                              'Shapes: 156',
432  #                          ['Shown',                     'Extent (lat-lon): (-24.5465, 63.2868, -13.4958, 66.5638)',
433  #                           'Shapes: 156',                              'Shapetype: Polygon',
434  #                           ('Extent (lat-lon):'                              self.layer.GetClassification()]))
 #                            ' (-24.5465, 63.2868, -13.4958, 66.5638)'),  
 #                           'Shapetype: Polygon',  
 #                           'Fill: None',  
 #                           'Outline: (0.000, 0.000, 0.000)']))  
435    
436    
437  if __name__ == "__main__":  if __name__ == "__main__":

Legend:
Removed from v.1987  
changed lines
  Added in v.2339

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26