only generate reference images on the fly for agg (not cairo) since we want to compare cairo to agg reference

This commit is contained in:
Dane Springmeyer 2012-11-20 15:29:26 -08:00
parent 3ce7ae7fc9
commit ff933fb033
2 changed files with 4 additions and 5 deletions

View File

@ -94,10 +94,10 @@ def summary(generate=False):
if generate:
actual = open(error[1],'r').read()
open(error[2],'wb').write(actual)
print "Generating reference image: '%s'" % error[2]
print str(idx+1) + ") Generating reference image: '%s'" % error[2]
continue
else:
print "Could not verify %s: No reference image found!" % error[1]
print str(idx+1) + ")Could not verify %s: No reference image found!" % error[1]
elif isinstance(error[0],int):
print str(idx+1) + ") \x1b[34m%s different pixels\x1b[0m:\n\t%s (\x1b[31mactual\x1b[0m)\n\t%s (\x1b[32mexpected\x1b[0m)" % error
elif isinstance(error[0],str):

View File

@ -102,15 +102,14 @@ def render(filename, width, height, bbox, quiet=False):
except Exception, e:
sys.stderr.write(e.message + '\n')
fail(actual_agg,expected,str(e.message))
if 'tiff' in actual or 'marker' in actual:
if try_cairo and ('tiff' in actual or 'marker' in actual):
actual_cairo = os.path.join(visual_output_dir, '%s-cairo.png' % actual)
if not quiet:
print "\"%s\" with size %dx%d with cairo..." % (filename, width, height),
try:
mapnik.render_to_file(m, actual_cairo,'ARGB32')
if not os.path.exists(expected):
# generate it on the fly
fail(actual_cairo,expected,None)
pass # will have been generated by agg test
else:
# cairo and agg differ in alpha for reasons unknown, so don't test it for now
diff = compare(actual_cairo, expected, threshold=1, alpha=False)