diff --git a/tests/data/good_maps/raster-alpha.xml b/tests/data/good_maps/raster-alpha.xml new file mode 100644 index 000000000..163bd463c --- /dev/null +++ b/tests/data/good_maps/raster-alpha.xml @@ -0,0 +1,19 @@ + + + + + + + white + + ../raster/white-alpha.tiff + gdal + + + + \ No newline at end of file diff --git a/tests/data/raster/white-alpha.tiff b/tests/data/raster/white-alpha.tiff new file mode 100644 index 000000000..b25998986 Binary files /dev/null and b/tests/data/raster/white-alpha.tiff differ diff --git a/tests/python_tests/images/support/raster-alpha.png b/tests/python_tests/images/support/raster-alpha.png new file mode 100644 index 000000000..a84c88eaf Binary files /dev/null and b/tests/python_tests/images/support/raster-alpha.png differ diff --git a/tests/python_tests/raster_alpha_test.py b/tests/python_tests/raster_alpha_test.py new file mode 100644 index 000000000..e8e72134b --- /dev/null +++ b/tests/python_tests/raster_alpha_test.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python + +from nose.tools import * +from utilities import execution_path +from copy import deepcopy + +import os, mapnik + +def setup(): + # All of the paths used are relative, if we run the tests + # from another directory we need to chdir() + os.chdir(execution_path('.')) + +def test_map_alpha_compare(): + m = mapnik.Map(600,400) + mapnik.load_map(m,'../data/good_maps/raster-alpha.xml') + m.zoom_all() + actual = '/tmp/mapnik-raster-alpha.png' + expected = 'images/support/raster-alpha.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() + [eval(run)() for run in dir() if 'test_' in run]