hook up visual tests to the 'make test' target
This commit is contained in:
parent
2ff8c3344e
commit
e570ea3a98
4 changed files with 14 additions and 6 deletions
1
Makefile
1
Makefile
|
@ -19,6 +19,7 @@ uninstall:
|
|||
|
||||
test:
|
||||
@python tests/run_tests.py -q
|
||||
@python tests/visual_tests/test.py
|
||||
|
||||
pep8:
|
||||
# https://gist.github.com/1903033
|
||||
|
|
|
@ -42,9 +42,9 @@ def compare(fn1, fn2):
|
|||
|
||||
def summary():
|
||||
global errors
|
||||
if len(errors) != 0:
|
||||
print "-"*80
|
||||
print "Summary:"
|
||||
if len(errors) != 0:
|
||||
for error in errors:
|
||||
if (error[1] is None):
|
||||
print "Could not verify %s: No reference image found!" % error[0]
|
||||
|
@ -52,3 +52,7 @@ def summary():
|
|||
print "%s failed: %d different pixels" % error
|
||||
print "-"*80
|
||||
sys.exit(1)
|
||||
else:
|
||||
print 'No errors detected!'
|
||||
print "-"*80
|
||||
sys.exit(0)
|
||||
|
|
|
@ -19,6 +19,7 @@ sizes_many_in_small_range = [(490, 100), (495, 100), (497, 100), (498, 100),
|
|||
(499, 100), (500, 100), (501, 100), (502, 100), (505, 100), (510, 100)]
|
||||
|
||||
dirname = os.path.dirname(__file__)
|
||||
|
||||
files = [
|
||||
{'name': "list", 'sizes': sizes_many_in_big_range},
|
||||
{'name': "simple", 'sizes': sizes_many_in_big_range},
|
||||
|
|
|
@ -4,6 +4,8 @@ import sys
|
|||
import os.path
|
||||
from compare import compare, summary
|
||||
|
||||
dirname = os.path.dirname(__file__)
|
||||
|
||||
class MyText(mapnik.FormattingNode):
|
||||
def __init__(self):
|
||||
mapnik.FormattingNode.__init__(self)
|
||||
|
@ -69,7 +71,7 @@ m.append_style('Style', style)
|
|||
|
||||
|
||||
layer = mapnik.Layer('Layer')
|
||||
layer.datasource = mapnik.Shapefile(file="data/points.shp")
|
||||
layer.datasource = mapnik.Shapefile(file=os.path.join(dirname,"data/points.shp"))
|
||||
layer.styles.append('Style')
|
||||
m.layers.append(layer)
|
||||
|
||||
|
@ -97,9 +99,9 @@ format_trees = [
|
|||
|
||||
for format_tree in format_trees:
|
||||
text.placements.defaults.format_tree = format_tree[1]
|
||||
mapnik.render_to_file(m, os.path.join("images", 'python-%s.png' % format_tree[0]), 'png')
|
||||
compare(os.path.join("images", 'python-%s.png' % format_tree[0]),
|
||||
os.path.join("images", 'python-%s-reference.png' % format_tree[0])
|
||||
mapnik.render_to_file(m, os.path.join(dirname,"images", 'python-%s.png' % format_tree[0]), 'png')
|
||||
compare(os.path.join(dirname,"images", 'python-%s.png' % format_tree[0]),
|
||||
os.path.join(dirname,"images", 'python-%s-reference.png' % format_tree[0])
|
||||
)
|
||||
|
||||
summary()
|
||||
|
|
Loading…
Reference in a new issue