test_python.py was still broken - actually fix it - refs #1513

This commit is contained in:
Dane Springmeyer 2013-07-30 14:31:29 -04:00
parent 19a7e9ad19
commit 2ea353bce0
6 changed files with 9 additions and 7 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View file

@ -2,9 +2,10 @@
import mapnik
import sys
import os.path
from compare import compare, summary
from compare import compare
dirname = os.path.dirname(__file__)
visual_output_dir = "/tmp/mapnik-visual-images"
class MyText(mapnik.FormattingNode):
def __init__(self):
@ -71,7 +72,7 @@ m.append_style('Style', style)
layer = mapnik.Layer('Layer')
layer.datasource = mapnik.Datasource(**{file=os.path.join(dirname,"data/points.csv"))
layer.datasource = mapnik.Datasource(**{'type':'csv','file':os.path.join(dirname,"data/points.csv")})
layer.styles.append('Style')
m.layers.append(layer)
@ -99,9 +100,10 @@ format_trees = [
for format_tree in format_trees:
text.placements.defaults.format_tree = format_tree[1]
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])
)
actual = os.path.join(visual_output_dir, 'python-%s.png' % format_tree[0])
expected = os.path.join(dirname,"images", 'python-%s-reference.png' % format_tree[0])
mapnik.render_to_file(m, actual, 'png8:m=h')
diff = compare(actual,expected)
if diff > 1:
print 'comparision failed between:\n %s (actual)\n %s (expected)' % (actual,expected)
summary()