22
22
# The optional argument allows you to compare a subset of the images
23
23
# (only those with names starting with the specified prefix).
24
24
#
25
- # Check build/images/diff/results.txt for results. This file is sorted
26
- # by PHASH difference (most different files on top.) The composite diff
27
- # images for failed tests (i.e., PHASH > 1.0) are stored in build/images/diff.
25
+ # Check build/images/diff/results.txt for results. The composite diff
26
+ # images for failed tests are stored in build/images/diff.
28
27
#
29
28
30
29
# PNG viewer on OSX. Switch this to whatever your system uses.
@@ -36,10 +35,6 @@ LC_NUMERIC="en_US.UTF-8"
36
35
# Check ImageMagick installation
37
36
command -v convert > /dev/null 2>&1 || { echo >&2 " Error: ImageMagick not found." ; exit 1; }
38
37
39
- # Show images over this PHASH threshold. This is probably too low, but
40
- # a good first pass.
41
- THRESHOLD=0.01
42
-
43
38
# Directories. You might want to change BASE, if you're running from a
44
39
# different working directory.
45
40
BASE=.
@@ -110,7 +105,7 @@ if [ -n "$NPROC" ]; then
110
105
nproc=$NPROC
111
106
fi
112
107
113
- echo " Running $totalImagesA tests with threshold $THRESHOLD (nproc=$nproc )..."
108
+ echo " Running $totalImagesA tests (nproc=$nproc )..."
114
109
115
110
function ProgressBar {
116
111
let _progress=(${1} * 100/${2} * 100)/100
@@ -142,14 +137,14 @@ function diff_image() {
142
137
fi
143
138
144
139
# If the two files are byte-for-byte identical, skip the image comparison below.
145
- cmp -s $fileA $fileB && echo $name " 0 " > $diff .pass && return
140
+ cmp -s $fileA $fileB && return
146
141
147
142
cp $fileA $diff -a.png
148
143
cp $fileB $diff -b.png
149
144
150
145
# Store the composite diff image.
151
146
# Add the result to results.text
152
- echo $name $hash > $diff .fail
147
+ echo $name > $diff .fail
153
148
# Threshold exceeded, save the diff and the original, current
154
149
cp $diff -diff.png $DIFF /$name .png
155
150
cp $diff -a.png $DIFF /$name ' _' $ANAME .png
@@ -206,18 +201,15 @@ cat $BDIR/*.fail 1>$RESULTS.fail 2>/dev/null
206
201
num_fails=` cat $RESULTS .fail | wc -l`
207
202
rm -f $BDIR /* .fail
208
203
209
- # Sort results by PHASH
210
- sort -r -n -k 2 $RESULTS .fail > $RESULTS
211
- sort -r -n -k 2 $BDIR /* .pass 1>> $RESULTS 2> /dev/null
204
+ # Sort results
205
+ sort $RESULTS .fail > $RESULTS
212
206
213
207
# The previous cleanup approach (rm -f) triggered the error: Argument list too long.
214
- find $BDIR -name ' *-temp.pass' -type f -delete
215
208
rm -f $RESULTS .fail
216
209
217
210
echo
218
211
echo Results stored in $DIFF /results.txt
219
- echo All images with a difference over threshold, $THRESHOLD , are
220
- echo available in $DIFF , sorted by perceptual hash.
212
+ echo All images with a difference, are available in $DIFF .
221
213
echo
222
214
223
215
if [ " $num_warnings " -gt 0 ]
0 commit comments