[mapserver-commits] r9439 - trunk/msautotest/pymod

svn at osgeo.org svn at osgeo.org
Sun Oct 11 16:37:47 EDT 2009


Author: warmerdam
Date: 2009-10-11 16:37:45 -0400 (Sun, 11 Oct 2009)
New Revision: 9439

Modified:
   trunk/msautotest/pymod/testlib.py
Log:
try to avoid invoking perceptualdiff on files not tiff or png (#2678)

Modified: trunk/msautotest/pymod/testlib.py
===================================================================
--- trunk/msautotest/pymod/testlib.py	2009-10-10 22:11:25 UTC (rev 9438)
+++ trunk/msautotest/pymod/testlib.py	2009-10-11 20:37:45 UTC (rev 9439)
@@ -80,13 +80,21 @@
         pass
 
     ###################################################################
-    # Test with perceptualdiff.  If we discover we don't have it, then
-    # set have_pdiff to 'false' so we will know.
+    # Test with perceptualdiff if this is tiff or png.  If we discover
+    # we don't have it, then set have_pdiff to 'false' so we will know.
     
     global have_pdiff
 
-    if have_pdiff != 'false':
+    try:
+        result = open(result_file, "rb").read(1000)
+    except:
+        result = ''
     
+    if have_pdiff != 'false' and \
+       ('\x49\x49\x2A\x00' in result \
+       or '\x49\x49\x00\x2A' in result \
+       or '\x89\x50\x4e\x47\x0d\x0a\x1a\x0a' in result):
+    
         try:
             cmd = 'perceptualdiff %s %s -verbose > pd.out' % (result_file,expected_file)
             os.system( cmd )



More information about the mapserver-commits mailing list