add test for #997- closes #997

This commit is contained in:
Dane Springmeyer 2012-07-25 13:16:46 -07:00
parent cc8f86e873
commit b298e21f8e
4 changed files with 17 additions and 5 deletions

View file

@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<!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>
<RasterSymbolizer opacity="1" scaling="bilinear" />
</Rule>
</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">
<StyleName>white</StyleName>
<StyleName>transp</StyleName>
<Datasource>
<Parameter name="file">../raster/transp.tiff</Parameter>
<Parameter name="type">gdal</Parameter>

View file

@ -2,7 +2,7 @@
<!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">
<Style name="white" filter-mode="first">
<Style name="white">
<Rule>
<RasterSymbolizer opacity="1" scaling="bilinear" />
</Rule>

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

View file

@ -23,6 +23,18 @@ def test_map_alpha_compare():
expected_im = mapnik.Image.open(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__":
setup()