Skip to content

Commit

Permalink
add test for #997- closes #997
Browse files Browse the repository at this point in the history
  • Loading branch information
Dane Springmeyer committed Jul 25, 2012
1 parent cc8f86e commit b298e21
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
8 changes: 4 additions & 4 deletions tests/data/good_maps/raster-alpha-gradient.xml
@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE Map[]> <!DOCTYPE Map[]>
<Map srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over" background-color="transparent"> <Map srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over" background-color="blue">


<Style name="white" filter-mode="first"> <Style name="transp">
<Rule> <Rule>
<RasterSymbolizer opacity="1" scaling="bilinear" /> <RasterSymbolizer opacity="1" scaling="bilinear" />
</Rule> </Rule>
</Style> </Style>
<Layer name="white" <Layer name="transp"
srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over"> srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over">
<StyleName>white</StyleName> <StyleName>transp</StyleName>
<Datasource> <Datasource>
<Parameter name="file">../raster/transp.tiff</Parameter> <Parameter name="file">../raster/transp.tiff</Parameter>
<Parameter name="type">gdal</Parameter> <Parameter name="type">gdal</Parameter>
Expand Down
2 changes: 1 addition & 1 deletion tests/data/good_maps/raster-alpha.xml
Expand Up @@ -2,7 +2,7 @@
<!DOCTYPE Map[]> <!DOCTYPE Map[]>
<Map srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over" background-color="red"> <Map srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over" background-color="red">


<Style name="white" filter-mode="first"> <Style name="white">
<Rule> <Rule>
<RasterSymbolizer opacity="1" scaling="bilinear" /> <RasterSymbolizer opacity="1" scaling="bilinear" />
</Rule> </Rule>
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions tests/python_tests/raster_alpha_test.py
Expand Up @@ -23,6 +23,18 @@ def test_map_alpha_compare():
expected_im = mapnik.Image.open(expected) expected_im = mapnik.Image.open(expected)
eq_(im.tostring(),expected_im.tostring(), 'failed comparing actual (%s) and expected(%s)' % (actual,'tests/python_tests/'+ expected)) eq_(im.tostring(),expected_im.tostring(), 'failed comparing actual (%s) and expected(%s)' % (actual,'tests/python_tests/'+ expected))


def test_map_alpha_gradient_compare():
m = mapnik.Map(600,400)
mapnik.load_map(m,'../data/good_maps/raster-alpha-gradient.xml')
m.zoom_all()
actual = '/tmp/mapnik-raster-alpha-gradient.png'
expected = 'images/support/raster-alpha-gradient.png'
im = mapnik.Image(m.width,m.height)
mapnik.render(m,im)
im.save(actual)
expected_im = mapnik.Image.open(expected)
eq_(im.tostring(),expected_im.tostring(), 'failed comparing actual (%s) and expected(%s)' % (actual,'tests/python_tests/'+ expected))



if __name__ == "__main__": if __name__ == "__main__":
setup() setup()
Expand Down

0 comments on commit b298e21

Please sign in to comment.