update tests as per #992

This commit is contained in:
Dane Springmeyer 2011-12-16 07:22:52 -08:00
parent 39801bf943
commit 6aefbd0d99
11 changed files with 45 additions and 52 deletions

View file

@ -593,7 +593,7 @@ class PDFPrinter:
for l in m.layers:
# extract the layer names for naming layers if we use OCG
self._layer_names.append(l.title or l.name)
self._layer_names.append(l.name)
layer_map = Map(m.width,m.height,m.srs)
layer_map.layers.append(l)
@ -884,7 +884,7 @@ class PDFPrinter:
for l in reversed(m.layers):
have_layer_header = False
added_styles={}
layer_title = l.title or l.name
layer_title = l.name
if layer_title in processed_layers:
continue
processed_layers.append(layer_title)
@ -906,8 +906,8 @@ class PDFPrinter:
if r.filter and str(r.filter) != "true":
if len(rule_text) > 0:
rule_text += " AND "
if r.title:
rule_text += r.title
if r.name:
rule_text += r.name
else:
rule_text += str(r.filter)
active_rules = tuple(active_rules)

View file

@ -1,7 +1,7 @@
<!DOCTYPE Map>
<Map background-color="white" srs="+init=epsg:4326" minimum-version="0.7.2">
<Style name="1">
<Rule title="foo">
<Rule>
<MarkersSymbolizer stroke="green" stroke-width="1.3" fill="yellow"/>
<LineSymbolizer stroke-width=".2" stroke="grey"/>
</Rule>

View file

@ -2,31 +2,31 @@
<Map background-color="white" srs="+init=epsg:4326" minimum-version="0.7.2">
<Style name="1">
<Rule title="foo">
<Rule>
<Filter>([name]='CHILE')</Filter>
<MarkersSymbolizer fill="darkgreen" opacity=".7" width="15" height="10" stroke="green" stroke-width="7" stroke-opacity=".2" placement="point" marker-type="ellipse"/>
</Rule>
<Rule title="foo">
<Rule>
<Filter>([name]='Australia')</Filter>
<MarkersSymbolizer fill="darkblue" opacity=".7" width="10" height="20" stroke="blue" stroke-width="7" stroke-opacity=".2" placement="point" marker-type="ellipse"/>
</Rule>
<Rule title="foo1">
<Rule>
<Filter>([name]='Brazil')</Filter>
<MarkersSymbolizer fill="darkorange" opacity=".7" width="20" height="10" stroke="orange" stroke-width="7" stroke-opacity=".2" placement="point" marker-type="ellipse"/>
</Rule>
<Rule title="foo">
<Rule>
<Filter>([name]='Mongolia')</Filter>
<MarkersSymbolizer fill="darkgoldenrod" opacity=".7" width="25" height="10" stroke="yellow" stroke-width="7" stroke-opacity=".2" placement="point" marker-type="ellipse"/>
</Rule>
<Rule title="foo">
<Rule>
<Filter>([name]='Sudan')</Filter>
<MarkersSymbolizer fill="darkcyan" opacity=".7" width="15" height="10" stroke="cadetblue" stroke-width="7" stroke-opacity=".2" placement="point" marker-type="ellipse"/>
</Rule>
<Rule title="foo">
<Rule>
<Filter>([name]='United States')</Filter>
<MarkersSymbolizer fill="#cc3344" opacity=".7" width="15" height="10" stroke="#cc3344" stroke-width="7" stroke-opacity=".2" placement="point" marker-type="ellipse"/>
</Rule>
<Rule title="foo">
<Rule>
<ElseFilter/>
<PointSymbolizer file="../svg/ellipses.svg"/>
</Rule>

View file

@ -1,17 +1,17 @@
<!DOCTYPE Map>
<Map background-color="#b5d0d0" srs="+init=epsg:4326" minimum-version="0.7.2">
<Style name="1">
<Rule title="foo">
<Rule>
<Filter>([x]=0)</Filter>
<TextSymbolizer size="10" dy="-10" face-name="DejaVu Sans Book" halo-radius="1" allow-overlap="true">[label]</TextSymbolizer>
<PointSymbolizer/>
</Rule>
<Rule title="foo">
<Rule>
<Filter>([y]=0)</Filter>
<TextSymbolizer size="10" dy="5" face-name="DejaVu Sans Book" halo-radius="1">[label]</TextSymbolizer>
<PointSymbolizer/>
</Rule>
<Rule title="foo">
<Rule>
<ElseFilter/>
<TextSymbolizer size="10" dy="-5" face-name="DejaVu Sans Book" halo-radius="1">[label]</TextSymbolizer>
<PointSymbolizer/>

View file

@ -1,17 +1,17 @@
<!DOCTYPE Map>
<Map background-color="#b5d0d0" srs="+init=epsg:4326" minimum-version="0.7.2">
<Style name="1">
<Rule title="foo">
<Rule>
<Filter>([x]=0)</Filter>
<TextSymbolizer size="10" dy="-10" face-name="DejaVu Sans Book" halo-radius="1" allow-overlap="true">[label]</TextSymbolizer>
<PointSymbolizer/>
</Rule>
<Rule title="foo">
<Rule>
<Filter>([y]=0)</Filter>
<TextSymbolizer size="10" dy="5" face-name="DejaVu Sans Book" halo-radius="1">[label]</TextSymbolizer>
<PointSymbolizer/>
</Rule>
<Rule title="foo">
<Rule>
<ElseFilter/>
<TextSymbolizer size="10" dy="-5" face-name="DejaVu Sans Book" halo-radius="1">[label]</TextSymbolizer>
<PointSymbolizer/>

View file

@ -1,17 +1,17 @@
<!DOCTYPE Map>
<Map background-color="#b5d0d0" srs="+init=epsg:4326" minimum-version="0.7.2">
<Style name="1">
<Rule title="foo">
<Rule>
<Filter>([x]=0)</Filter>
<TextSymbolizer size="10" dy="-10" face-name="DejaVu Sans Book" halo-radius="1" allow-overlap="true">[label]</TextSymbolizer>
<PointSymbolizer/>
</Rule>
<Rule title="foo">
<Rule>
<Filter>([y]=0)</Filter>
<TextSymbolizer size="10" dy="5" face-name="DejaVu Sans Book" halo-radius="1">[label]</TextSymbolizer>
<PointSymbolizer/>
</Rule>
<Rule title="foo">
<Rule>
<ElseFilter/>
<TextSymbolizer size="10" dy="-5" face-name="DejaVu Sans Book" halo-radius="1">[label]</TextSymbolizer>
<PointSymbolizer/>

View file

@ -1,38 +1,38 @@
<!DOCTYPE Map>
<Map background-color="#b5d0d0" srs="+init=epsg:4326" minimum-version="0.7.2">
<Style name="1">
<Rule title="foo">
<Rule>
<Filter>([name]='CHILE')</Filter>
<TextSymbolizer size="10" dy="5" face-name="DejaVu Sans Book" text-transform="lowercase" wrap-width="10" wrap-character=" " halo-radius="1">[name] + ' (default OGC pixel)'</TextSymbolizer>
<PointSymbolizer/>
</Rule>
<Rule title="foo">
<Rule>
<Filter>([name]='Australia')</Filter>
<TextSymbolizer size="10" dy="20" face-name="DejaVu Sans Book" halo-radius="1">[name] + ' (png)'</TextSymbolizer>
<PointSymbolizer file="../images/dummy.png" allow-overlap="true"/>
</Rule>
<Rule title="foo1">
<Rule>
<Filter>([name]='Brazil')</Filter>
<TextSymbolizer size="10" dy="20" face-name="DejaVu Sans Book" halo-radius="1">[name] + ' (svg &amp; tif)'</TextSymbolizer>
<PointSymbolizer file="../images/dummy.tif" allow-overlap="true"/>
<PointSymbolizer file="../svg/ellipses.svg" allow-overlap="true"/>
</Rule>
<Rule title="foo">
<Rule>
<Filter>([name]='Mongolia')</Filter>
<TextSymbolizer size="10" dy="20" face-name="DejaVu Sans Book" halo-radius="1">[name] + ' (tiff)'</TextSymbolizer>
<PointSymbolizer file="../images/dummy.tiff" allow-overlap="true"/>
</Rule>
<Rule title="foo">
<Rule>
<Filter>([name]='Sudan')</Filter>
<TextSymbolizer size="10" dy="20" face-name="DejaVu Sans Book" halo-radius="1">[name] + ' (jpeg)'</TextSymbolizer>
<PointSymbolizer file="../images/dummy.jpeg"/>
</Rule>
<Rule title="foo">
<Rule>
<Filter>([name]='United States')</Filter>
<TextSymbolizer size="10" dy="20" face-name="DejaVu Sans Book" halo-radius="1">[name] + ' (jpg)'</TextSymbolizer>
<PointSymbolizer file="../images/dummy.jpg"/>
</Rule>
<Rule title="foo">
<Rule>
<ElseFilter/>
<TextSymbolizer size="10" dy="20" face-name="DejaVu Sans Book" halo-radius="1">[name]</TextSymbolizer>
<PointSymbolizer file="../images/bogus_will_fail.png"/>

View file

@ -1,11 +1,11 @@
<!DOCTYPE Map>
<Map background-color="#b5d0d0" srs="+init=epsg:4326" minimum-version="0.7.2">
<Style name="1">
<Rule title="foo1">
<Rule>
<Filter>([name]='Brazil' or [name]='Mongolia' or [name]='Sudan')</Filter>
<PointSymbolizer file="../svg/point_sm.svg" allow-overlap="true"/>
</Rule>
<Rule title="foo">
<Rule>
<ElseFilter/>
<PointSymbolizer file="../svg/point_sm.svg" ignore-placement="true"/>
<PointSymbolizer/>

View file

@ -1,26 +1,26 @@
<!DOCTYPE Map>
<Map background-color="#b5d0d0" minimum-version="0.7.2">
<Style name="test">
<Rule title="asia">
<Rule name="asia">
<Filter>([REGION]=142)</Filter>
<PointSymbolizer file="../images/dummy.png" allow-overlap="true"/>
</Rule>
<Rule title="europe">
<Rule name="europe">
<Filter>([REGION]=150)</Filter>
<!-- requires at least Mapnik 0.7.1 to work due to http://trac.mapnik.org/ticket/508 -->
<PolygonPatternSymbolizer file="../images/dummy.png"/>
</Rule>
<Rule title="americas">
<Rule name="americas">
<Filter>([REGION]=19)</Filter>
<!-- requires at least Mapnik 0.7.1 to work due to http://trac.mapnik.org/ticket/508 -->
<LinePatternSymbolizer file="../images/dummy.png"/>
</Rule>
<Rule title="Africa">
<Rule name="Africa">
<Filter>([REGION]=2)</Filter>
<ShieldSymbolizer placement="vertex" size="10" fill="#000000" file="../images/dummy.png" face-name="DejaVu Sans Bold">[NAME]</ShieldSymbolizer>
</Rule>
<Rule title="rest">
<Rule name="rest">
<ElseFilter/>
<LineSymbolizer stroke-width="1"/>
</Rule>

View file

@ -1,31 +1,31 @@
<Map srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over" background-color="steelblue" minimum-version="0.7.2">
<Style name="labels">
<Rule title="foo">
<Rule>
<Filter>([name]='CHILE')</Filter>
<TextSymbolizer size="15" orientation="45" face-name="DejaVu Sans Book" halo-radius="1">'45˚ angle'</TextSymbolizer>
</Rule>
<Rule title="foo">
<Rule>
<Filter>([name]='Australia')</Filter>
<TextSymbolizer size="15" orientation="-45" face-name="DejaVu Sans Book" halo-radius="1">'- 45˚ angle'</TextSymbolizer>
</Rule>
<Rule title="foo1">
<Rule>
<Filter>([name]='Brazil')</Filter>
<TextSymbolizer size="15" orientation="90" face-name="DejaVu Sans Book" halo-radius="1">'90˚ angle'</TextSymbolizer>
</Rule>
<Rule title="foo">
<Rule>
<Filter>([name]='Mongolia')</Filter>
<TextSymbolizer size="15" orientation="-90" face-name="DejaVu Sans Book" halo-radius="1">'- 90˚ angle'</TextSymbolizer>
</Rule>
<Rule title="foo">
<Rule>
<Filter>([name]='South Sudan')</Filter>
<TextSymbolizer size="15" orientation="180" face-name="DejaVu Sans Book" halo-radius="1">'180&#730; angle'</TextSymbolizer>
</Rule>
<Rule title="foo">
<Rule>
<Filter>([name]='United States')</Filter>
<TextSymbolizer size="15" face-name="DejaVu Sans Book" halo-radius="1">'no rotation of text'</TextSymbolizer>
</Rule>
<Rule title="foo">
<Rule>
<ElseFilter/>
<TextSymbolizer size="15" face-name="DejaVu Sans Book" halo-radius="1">[name]</TextSymbolizer>
</Rule>

View file

@ -213,12 +213,10 @@ def test_layer_init():
eq_(l.clear_label_cache,False)
eq_(l.cache_features,False)
eq_(l.visible(1),True)
eq_(l.abstract,'')
eq_(l.active,True)
eq_(l.datasource,None)
eq_(l.queryable,False)
eq_(l.srs,'+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')
eq_(l.title,'')
# Map initialization
def test_map_init():
@ -399,7 +397,6 @@ def test_rule_init():
r = mapnik.Rule()
eq_(r.name, '')
eq_(r.title, '')
eq_(r.min_scale, 0)
eq_(r.max_scale, float('inf'))
eq_(r.has_else(), False)
@ -420,34 +417,30 @@ def test_rule_init():
r = mapnik.Rule("Name")
eq_(r.name, 'Name')
eq_(r.title, '')
eq_(r.min_scale, 0)
eq_(r.max_scale, float('inf'))
eq_(r.has_else(), False)
eq_(r.has_also(), False)
r = mapnik.Rule("Name", "Title")
r = mapnik.Rule("Name")
eq_(r.name, 'Name')
eq_(r.title, 'Title')
eq_(r.min_scale, 0)
eq_(r.max_scale, float('inf'))
eq_(r.has_else(), False)
eq_(r.has_also(), False)
r = mapnik.Rule("Name", "Title", min_scale)
r = mapnik.Rule("Name", min_scale)
eq_(r.name, 'Name')
eq_(r.title, 'Title')
eq_(r.min_scale, min_scale)
eq_(r.max_scale, float('inf'))
eq_(r.has_else(), False)
eq_(r.has_also(), False)
r = mapnik.Rule("Name", "Title", min_scale, max_scale)
r = mapnik.Rule("Name", min_scale, max_scale)
eq_(r.name, 'Name')
eq_(r.title, 'Title')
eq_(r.min_scale, min_scale)
eq_(r.max_scale, max_scale)
eq_(r.has_else(), False)