add visual tests for pgraster to try to make sense of failures

This commit is contained in:
Dane Springmeyer 2015-01-26 21:36:47 -08:00
parent 921c058d7d
commit ebfbbef454
60 changed files with 31 additions and 9 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 B

View file

@ -4,7 +4,7 @@ from nose.tools import *
import atexit
import cProfile, pstats, io
import time
from utilities import execution_path, run_all
from utilities import execution_path, run_all, side_by_side_image
from subprocess import Popen, PIPE
import os, mapnik
from Queue import Queue
@ -13,7 +13,6 @@ import sys
import re
from binascii import hexlify, unhexlify
MAPNIK_TEST_DBNAME = 'mapnik-tmp-pgraster-test-db'
POSTGIS_TEMPLATE_DBNAME = 'template_postgis'
DEBUG_OUTPUT=False
@ -113,6 +112,20 @@ def drop_imported(tabname, overview):
for of in overview.split(','):
psql_run('DROP TABLE IF EXISTS "o_' + of + '_' + tabname + '";')
def compare_images(expected,im):
if not os.path.exists(expected):
print 'generating expected image %s' % expected
im.save(expected,'png32')
expected_im = mapnik.Image.open(expected)
diff = expected.replace('.png','-diff.png')
if len(im.tostring("png32")) != len(expected_im.tostring("png32")):
compared = side_by_side_image(expected_im, im)
compared.save(diff)
assert False,'images do not match, check diff at %s' % diff
else:
if os.path.exists(diff): os.unlink(diff)
return True
if 'pgraster' in mapnik.DatasourceCache.plugin_names() \
and createdb_and_dropdb_on_path() \
and psql_can_connect() \
@ -271,7 +284,8 @@ if 'pgraster' in mapnik.DatasourceCache.plugin_names() \
mapnik.render(mm, im)
lap = time.time() - t0
log('T ' + str(lap) + ' -- ' + lbl + ' E:full')
#im.save('/tmp/xfull.png') # for debugging
expected = 'images/support/pgraster/%s-%s-%s-%s-box1.png' % (lyr.name,lbl,overview,clip)
compare_images(expected,im)
# no data
eq_(hexlify(im.view(3,3,1,1).tostring()), '00000000')
eq_(hexlify(im.view(250,250,1,1).tostring()), '00000000')
@ -290,10 +304,12 @@ if 'pgraster' in mapnik.DatasourceCache.plugin_names() \
newenv = mapnik.Box2d(166,-105,191,-77)
mm.zoom_to_box(newenv)
t0 = time.time() # we want wall time to include IO waits
im = mapnik.Image(mm.width, mm.height)
mapnik.render(mm, im)
lap = time.time() - t0
log('T ' + str(lap) + ' -- ' + lbl + ' E:1/10')
#im.save('/tmp/xtenth.png') # for debugging
expected = 'images/support/pgraster/%s-%s-%s-%s-box2.png' % (lyr.name,lbl,overview,clip)
compare_images(expected,im)
# no data
eq_(hexlify(im.view(255,255,1,1).tostring()), '00000000')
eq_(hexlify(im.view(200,40,1,1).tostring()), '00000000')
@ -372,7 +388,8 @@ if 'pgraster' in mapnik.DatasourceCache.plugin_names() \
mapnik.render(mm, im)
lap = time.time() - t0
log('T ' + str(lap) + ' -- ' + lbl + ' E:full')
#im.save('/tmp/xfull.png') # for debugging
expected = 'images/support/pgraster/%s-%s-%s-%s-%s-box1.png' % (lyr.name,tnam,lbl,overview,clip)
compare_images(expected,im)
# no data
eq_(hexlify(im.view(3,16,1,1).tostring()), '00000000')
eq_(hexlify(im.view(128,16,1,1).tostring()), '00000000')
@ -389,10 +406,12 @@ if 'pgraster' in mapnik.DatasourceCache.plugin_names() \
-12328997.49148983,4508957.34625536)
mm.zoom_to_box(newenv)
t0 = time.time() # we want wall time to include IO waits
im = mapnik.Image(mm.width, mm.height)
mapnik.render(mm, im)
lap = time.time() - t0
log('T ' + str(lap) + ' -- ' + lbl + ' E:1/10')
#im.save('/tmp/xtenth.png') # for debugging
expected = 'images/support/pgraster/%s-%s-%s-%s-%s-box2.png' % (lyr.name,tnam,lbl,overview,clip)
compare_images(expected,im)
# no data
eq_(hexlify(im.view(3,16,1,1).tostring()), '00000000')
eq_(hexlify(im.view(128,16,1,1).tostring()), '00000000')
@ -486,7 +505,8 @@ if 'pgraster' in mapnik.DatasourceCache.plugin_names() \
mapnik.render(mm, im)
lap = time.time() - t0
log('T ' + str(lap) + ' -- ' + lbl + ' E:full')
#im.save('/tmp/xfull.png') # for debugging
expected = 'images/support/pgraster/%s-%s-%s-%s.png' % (lyr.name,lbl,pixtype,value)
compare_images(expected,im)
h = format(value, '02x')
hex_v = h+h+h+'ff'
h = format(val_a, '02x')
@ -600,7 +620,8 @@ if 'pgraster' in mapnik.DatasourceCache.plugin_names() \
mapnik.render(mm, im)
lap = time.time() - t0
log('T ' + str(lap) + ' -- ' + lbl + ' E:full')
#im.save('/tmp/xfull.png') # for debugging
expected = 'images/support/pgraster/%s-%s-%s-%s.png' % (lyr.name,lbl,pixtype,value)
compare_images(expected,im)
h = format(value, '02x')
hex_v = '0000ffff'
hex_a = 'ff0000ff'
@ -719,7 +740,8 @@ if 'pgraster' in mapnik.DatasourceCache.plugin_names() \
mapnik.render(mm, im)
lap = time.time() - t0
log('T ' + str(lap) + ' -- ' + lbl + ' E:full')
im.save('/tmp/xfull.png') # for debugging
expected = 'images/support/pgraster/%s-%s-%s-%s-%s-%s-%s-%s-%s.png' % (lyr.name,lbl, pixtype, r, g, b, a, g1, b1)
compare_images(expected,im)
hex_v = format(r << 24 | g << 16 | b << 8 | a, '08x')
hex_a = format(r << 24 | g1 << 16 | b << 8 | a, '08x')
hex_b = format(r << 24 | g << 16 | b1 << 8 | a, '08x')