convert raster_symbolizer_test to use full image comparisons

This commit is contained in:
Dane Springmeyer 2014-12-03 13:53:04 -05:00
parent 4d39d2aac1
commit 02135991ed
4 changed files with 24 additions and 6 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -52,9 +52,14 @@ def test_dataraster_coloring():
im = mapnik.Image(_map.width,_map.height) im = mapnik.Image(_map.width,_map.height)
mapnik.render(_map, im) mapnik.render(_map, im)
imdata = im.tostring() expected_file = './images/support/dataraster_coloring.png'
# we have some values in the [20,30) interval so check that they're colored actual_file = '/tmp/' + os.path.basename(expected_file)
assert contains_word('\xff\xff\x00\xff', imdata) im.save(actual_file,'png32')
if not os.path.exists(expected_file) or os.environ.get('UPDATE'):
im.save(expected_file,'png32')
actual = mapnik.Image.open(actual_file)
expected = mapnik.Image.open(expected_file)
eq_(actual.tostring('png32'),expected.tostring('png32'), 'failed comparing actual (%s) and expected (%s)' % (actual_file,expected_file))
def test_dataraster_query_point(): def test_dataraster_query_point():
srs = '+init=epsg:32630' srs = '+init=epsg:32630'
@ -165,8 +170,14 @@ def test_raster_warping():
im = mapnik.Image(_map.width,_map.height) im = mapnik.Image(_map.width,_map.height)
mapnik.render(_map, im) mapnik.render(_map, im)
imdata = im.tostring() expected_file = './images/support/raster_warping.png'
assert contains_word('\xff\xff\x00\xff', imdata) actual_file = '/tmp/' + os.path.basename(expected_file)
im.save(actual_file,'png32')
if not os.path.exists(expected_file) or os.environ.get('UPDATE'):
im.save(expected_file,'png32')
actual = mapnik.Image.open(actual_file)
expected = mapnik.Image.open(expected_file)
eq_(actual.tostring('png32'),expected.tostring('png32'), 'failed comparing actual (%s) and expected (%s)' % (actual_file,expected_file))
def test_raster_warping_does_not_overclip_source(): def test_raster_warping_does_not_overclip_source():
lyrSrs = "+init=epsg:32630" lyrSrs = "+init=epsg:32630"
@ -192,7 +203,14 @@ def test_raster_warping_does_not_overclip_source():
im = mapnik.Image(_map.width,_map.height) im = mapnik.Image(_map.width,_map.height)
mapnik.render(_map, im) mapnik.render(_map, im)
assert im.view(0,200,1,1).tostring()=='\xff\xff\x00\xff' expected_file = './images/support/raster_warping_does_not_overclip_source.png'
actual_file = '/tmp/' + os.path.basename(expected_file)
im.save(actual_file,'png32')
if not os.path.exists(expected_file) or os.environ.get('UPDATE'):
im.save(expected_file,'png32')
actual = mapnik.Image.open(actual_file)
expected = mapnik.Image.open(expected_file)
eq_(actual.tostring('png32'),expected.tostring('png32'), 'failed comparing actual (%s) and expected (%s)' % (actual_file,expected_file))
if __name__ == "__main__": if __name__ == "__main__":
setup() setup()