Permalink
Browse files

add ability to generate expected test results on the fly

  • Loading branch information...
1 parent ef94bc8 commit 7cf4a00af9530ba2aa46ba1a4a5cb2cb41fe166a Dane Springmeyer committed Sep 26, 2012
Showing with 8 additions and 2 deletions.
  1. +8 −2 tests/visual_tests/compare.py
@@ -49,15 +49,21 @@ def compare(actual, expected):
passed += 1
return diff
-def summary():
+def summary(generate=False):
global errors
global passed
print "-"*80
print "Visual text rendering summary:",
if len(errors) != 0:
for error in errors:
if (error[0] is None):
- print "Could not verify %s: No reference image found!" % error[1]
+ if generate:
+ actual = open(error[1],'r').read()
+ open(error[2],'wb').write(actual)
+ print "Generating reference image: '%s'" % error[2]
+ continue
+ else:
+ print "Could not verify %s: No reference image found!" % error[1]
else:
print "Failed: %d different pixels:\n\t%s (actual)\n\t%s (expected)" % error
sys.exit(1)

0 comments on commit 7cf4a00

Please sign in to comment.