40 |
|
|
41 |
from Thuban.Model.save import save_session |
from Thuban.Model.save import save_session |
42 |
from Thuban.Model.load import load_session, parse_color, LoadError |
from Thuban.Model.load import load_session, parse_color, LoadError |
43 |
from Thuban.Model.color import Color |
from Thuban.Model.color import Transparent |
44 |
from Thuban.Model.classification import ClassGroupProperties, ClassGroupRange,\ |
from Thuban.Model.classification import ClassGroupProperties, ClassGroupRange,\ |
45 |
ClassGroupSingleton, ClassGroupDefault |
ClassGroupSingleton, ClassGroupDefault |
46 |
|
|
150 |
if data[CLASSES][i][GROUP_TYPE] == "default": |
if data[CLASSES][i][GROUP_TYPE] == "default": |
151 |
g = ClassGroupDefault(props, data[CLASSES][i][GROUP_LABEL]) |
g = ClassGroupDefault(props, data[CLASSES][i][GROUP_LABEL]) |
152 |
elif data[CLASSES][i][GROUP_TYPE] == "range": |
elif data[CLASSES][i][GROUP_TYPE] == "range": |
153 |
g = ClassGroupRange(data[CLASSES][i][GROUP_DATA][0], |
g = ClassGroupRange((data[CLASSES][i][GROUP_DATA][0], |
154 |
data[CLASSES][i][GROUP_DATA][1], |
data[CLASSES][i][GROUP_DATA][1]), |
155 |
props, data[CLASSES][i][GROUP_LABEL]) |
props, data[CLASSES][i][GROUP_LABEL]) |
156 |
elif data[CLASSES][i][GROUP_TYPE] == "single": |
elif data[CLASSES][i][GROUP_TYPE] == "single": |
157 |
g = ClassGroupSingleton(data[CLASSES][i][GROUP_DATA], |
g = ClassGroupSingleton(data[CLASSES][i][GROUP_DATA], |
214 |
os.pardir, os.pardir, |
os.pardir, os.pardir, |
215 |
"Data", "iceland", |
"Data", "iceland", |
216 |
"political.shp"))) |
"political.shp"))) |
217 |
eq(layer.GetClassification().GetDefaultFill(), Color.Transparent) |
eq(layer.GetClassification().GetDefaultFill(), Transparent) |
218 |
eq(layer.GetClassification().GetDefaultLineColor().hex(), "#000000") |
eq(layer.GetClassification().GetDefaultLineColor().hex(), "#000000") |
219 |
eq(layer.Visible(), True) |
eq(layer.Visible(), True) |
220 |
|
|
504 |
|
|
505 |
file_contents = '''<?xml version="1.0" encoding="UTF-8"?> |
file_contents = '''<?xml version="1.0" encoding="UTF-8"?> |
506 |
<!DOCTYPE session SYSTEM "thuban-0.8.dtd"> |
<!DOCTYPE session SYSTEM "thuban-0.8.dtd"> |
507 |
<session title="A Joined Table session"> |
<session xmlns="http://thuban.intevation.org/dtds/thuban-0.8.dtd" title="A Joined Table session"> |
508 |
<filetable filename="load_joinedtable.dbf" |
<fileshapesource filetype="shapefile" id="D137227612" |
509 |
title="Some Title" |
filename="../../Data/iceland/roads-line.shp"/> |
510 |
filetype="DBF" id="D141881756"/> |
<filetable filetype="DBF" filename="load_joinedtable.dbf" id="D136171140" |
511 |
<fileshapesource filename="../../Data/iceland/roads-line.shp" |
title="Some Title"/> |
512 |
filetype="shapefile" id="D142197204"/> |
<jointable leftcolumn="RDLNTYPE" right="D136171140" |
513 |
<jointable id="D142180284" |
title="Joined" rightcolumn="RDTYPE" id="D136169900" left="D137227612"/> |
514 |
title="Joined" |
<derivedshapesource table="D136169900" shapesource="D137227612" |
515 |
leftcolumn="RDLNTYPE" left="D142197204" |
id="D136170932"/> |
|
rightcolumn="RDTYPE" right="D141881756"/> |
|
|
<derivedshapesource id="D141915644" |
|
|
table="D142180284" shapesource="D142197204"/> |
|
516 |
<map title="Test Map"> |
<map title="Test Map"> |
517 |
<layer title="My Layer" |
<layer shapestore="D136170932" visible="true" stroke="#000000" |
518 |
shapestore="D141915644" visible="true" |
title="My Layer" stroke_width="1" fill="None"/> |
|
stroke="#000000" stroke_width="1" fill="None"/> |
|
519 |
</map> |
</map> |
520 |
</session>''' |
</session> |
521 |
|
''' |
522 |
|
|
523 |
def setUp(self): |
def setUp(self): |
524 |
"""Extend inherited method to create the dbffile for the join""" |
"""Extend inherited method to create the dbffile for the join""" |
542 |
# FIXME: The tests shouldn't assume a certain order of the tables |
# FIXME: The tests shouldn't assume a certain order of the tables |
543 |
self.assertEquals(tables[0].Title(), "Some Title") |
self.assertEquals(tables[0].Title(), "Some Title") |
544 |
self.assertEquals(tables[1].Title(), "Joined") |
self.assertEquals(tables[1].Title(), "Joined") |
545 |
|
self.check_format() |
546 |
|
|
547 |
|
|
548 |
class TestLoadError(LoadSessionTest): |
class TestLoadError(LoadSessionTest): |