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

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

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

revision 2620 by jonathan, Fri May 6 14:19:23 2005 UTC revision 2642 by bh, Fri Jul 1 20:49:04 2005 UTC
# Line 1  Line 1 
1  # Copyright (c) 2002, 2003, 2004 by Intevation GmbH  # Copyright (c) 2002, 2003, 2004, 2005 by Intevation GmbH
2  # Authors:  # Authors:
3  # Bernhard Herzog <[email protected]>  # Bernhard Herzog <[email protected]>
4  #  #
# Line 40  from xmlsupport import sax_eventlist Line 40  from xmlsupport import sax_eventlist
40  import dbflib  import dbflib
41  import shapelib  import shapelib
42    
43    from Thuban import internal_from_unicode
44  from Thuban.Model.save import save_session  from Thuban.Model.save import save_session
45  from Thuban.Model.load import load_session, parse_color, LoadError, \  from Thuban.Model.load import load_session, parse_color, LoadError, \
46       LoadCancelled       LoadCancelled
# Line 214  class TestSingleLayer(LoadSessionTest): Line 215  class TestSingleLayer(LoadSessionTest):
215          self.session = session          self.session = session
216    
217          # Check the title          # Check the title
218          eq(session.Title(), "Stra\xdfen & Landmarken")          eq(session.Title(), internal_from_unicode(u"Stra\xdfen & Landmarken"))
219    
220          # the session has one map.          # the session has one map.
221          maps = session.Maps()          maps = session.Maps()
# Line 222  class TestSingleLayer(LoadSessionTest): Line 223  class TestSingleLayer(LoadSessionTest):
223    
224          # Check the map's attributes          # Check the map's attributes
225          map = maps[0]          map = maps[0]
226          eq(map.Title(), "\xdcbersicht")          eq(map.Title(), internal_from_unicode(u"\xdcbersicht"))
227          proj = map.GetProjection()          proj = map.GetProjection()
228          eq(proj.GetName(), "WGS 84 / UTM zone 27N")          eq(proj.GetName(), "WGS 84 / UTM zone 27N")
229          eq(proj.EPSGCode(), "32627")          eq(proj.EPSGCode(), "32627")
# Line 237  class TestSingleLayer(LoadSessionTest): Line 238  class TestSingleLayer(LoadSessionTest):
238    
239          # Check the layer attributes          # Check the layer attributes
240          layer = layers[0]          layer = layers[0]
241          eq(layer.Title(), "K\xfcste")          eq(layer.Title(), internal_from_unicode(u"K\xfcste"))
242          self.failUnless(filenames_equal(layer.ShapeStore().FileName(),          self.failUnless(filenames_equal(layer.ShapeStore().FileName(),
243                                          os.path.join(self.temp_dir(),                                          os.path.join(self.temp_dir(),
244                                                       os.pardir, os.pardir,                                                       os.pardir, os.pardir,
# Line 510  class TestClassification(ClassificationT Line 511  class TestClassification(ClassificationT
511                              ("#000000", 2, "None")),                              ("#000000", 2, "None")),
512                           ("single", "1", "",                           ("single", "1", "",
513                              ("#000000", 10, "None")),                              ("#000000", 10, "None")),
514                           ("single", "\xe4\xf6\xfc", "\xdcml\xe4uts",                           ("single", internal_from_unicode(u"\xe4\xf6\xfc"),
515                              internal_from_unicode(u"\xdcml\xe4uts"),
516                              ("#000000", 1, "None"))]),                              ("#000000", 1, "None"))]),
517                       ("My Layer 2", 4,                       ("My Layer 2", 4,
518                           [("default", (), "",                           [("default", (), "",
# Line 792  class TestLabelLayer(LoadSessionTest): Line 794  class TestLabelLayer(LoadSessionTest):
794    
795          label_layer = self.session.Maps()[0].LabelLayer()          label_layer = self.session.Maps()[0].LabelLayer()
796          expected_labels = [(-21.5, 64.25, "RUINS", ALIGN_LEFT, ALIGN_CENTER),          expected_labels = [(-21.5, 64.25, "RUINS", ALIGN_LEFT, ALIGN_CENTER),
797                             (-15.125, 64.75, "H\xfctte", ALIGN_RIGHT, ALIGN_TOP),                             (-15.125, 64.75, internal_from_unicode(u"H\xfctte"),
798                                ALIGN_RIGHT, ALIGN_TOP),
799                             ]                             ]
800          for label, values in zip(label_layer.Labels(), expected_labels):          for label, values in zip(label_layer.Labels(), expected_labels):
801              self.assertEquals((label.x, label.y, label.text, label.halign,              self.assertEquals((label.x, label.y, label.text, label.halign,

Legend:
Removed from v.2620  
changed lines
  Added in v.2642

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26