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 |
# |
# |
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 |
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() |
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") |
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, |
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", (), "", |
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, |