More flexible image comparison.
authorJosé Fonseca <jose.r.fonseca@gmail.com>
Mon, 12 Dec 2011 15:35:28 +0000 (15:35 +0000)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Mon, 12 Dec 2011 15:35:28 +0000 (15:35 +0000)
driver.py

index 4f40ac4ba85140dbf853aa5cfc13c349e9053793..49c01f2e8561340842e9a6ef9a0f1bf8521c1351 100755 (executable)
--- a/driver.py
+++ b/driver.py
@@ -216,6 +216,8 @@ class TestCase:
 
     verbose = False
 
+    threshold_precision = 12.0
+
     def __init__(self):
         self.stateCache = {}
     
@@ -312,8 +314,9 @@ class TestCase:
 
         from snapdiff import Comparer
         comparer = Comparer(refImage, srcImage)
-        match = comparer.ae()
-        if not match:
+        precision = comparer.precision()
+        sys.stdout.write('precision of %f bits against %s\n' % (precision, refImageFileName))
+        if precision < self.threshold_precision:
             prefix = '%s.%u' % (self.getNamePrefix(), callNo)
             srcImageFileName = prefix + '.src.png'
             srcImage.save(srcImageFileName)