Ticket #2678 (closed defect: fixed)
msautotest compare_result() function in testlib.py run the perceptualdiff command eventhough this is not an image file
| Reported by: | nsavard | Owned by: | warmerdam |
|---|---|---|---|
| Priority: | normal | Milestone: | 5.6 release |
| Component: | msautotest | Version: | svn-trunk (development) |
| Severity: | normal | Keywords: | msautotest perceptualdiff |
| Cc: | warmerdam |
Description
The perceptualdiff comparison in the compare_result() function of the msautotest (in testlib.py), occurs even though this is not an image file. I propose to add the following test to overcome this issue:
result = open(result_file, "rb").read()
#If PerceptualDiff is installed and this is an image file
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):
The complete code concerning the perceptualdiff comparison is shown below.
###################################################################
# Test with perceptualdiff. If we discover we don't have it, then
# set have_pdiff to 'false' so we will know.
global have_pdiff
result = open(result_file, "rb").read()
#If PerceptualDiff is installed and this is an image file
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 > pd.out' % (result_file,expected_file)
os.system( cmd )
pdout = open('pd.out').read()
os.remove( 'pd.out' )
if string.find(pdout,'PASS:') != -1 \
and string.find(pdout,'binary identical') != -1:
return 'files_differ_image_match'
if string.find(pdout,'PASS:') != -1 \
and string.find(pdout,'indistinguishable') != -1:
return 'files_differ_image_nearly_match'
if string.find(pdout,'PASS:') == -1 \
and string.find(pdout,'FAIL:') == -1:
have_pdiff = 'false'
except:
pass
return 'nomatch'
Change History
Note: See
TracTickets for help on using
tickets.
