Skip to content

Commit bdec66a

Browse files
committed
binary visual regression, no threshold
1 parent 666aa08 commit bdec66a

File tree

1 file changed

+14
-27
lines changed

1 file changed

+14
-27
lines changed

tools/visual_regression.sh

Lines changed: 14 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -147,32 +147,19 @@ function diff_image() {
147147
cp $fileA $diff-a.png
148148
cp $fileB $diff-b.png
149149

150-
# Calculate the difference metric and store the composite diff image.
151-
local hash=`compare -metric PHASH -highlight-color '#ff000050' $diff-b.png $diff-a.png $diff-diff.png 2>&1`
152-
153-
# Remove scientific notation
154-
local hash6=`printf "%.6f" $hash`
155-
local THRESHOLD6=`printf "%.6f" $THRESHOLD`
156-
157-
local isGT=`echo "$hash6 > $THRESHOLD6" | bc -l`
158-
if [ "$isGT" == "1" ]
159-
then
160-
# Add the result to results.text
161-
echo $name $hash >$diff.fail
162-
# Threshold exceeded, save the diff and the original, current
163-
cp $diff-diff.png $DIFF/$name.png
164-
cp $diff-a.png $DIFF/$name'_'$ANAME.png
165-
cp $diff-b.png $DIFF/$name'_'$BNAME.png
166-
echo
167-
echo "Test: $name"
168-
echo " PHASH value exceeds threshold: $hash > $THRESHOLD"
169-
echo " Image diff stored in $DIFF/$name.png"
170-
# $VIEWER "$diff-diff.png" "$diff-a.png" "$diff-b.png"
171-
# echo 'Hit return to process next image...'
172-
# read
173-
else
174-
echo $name $hash >$diff.pass
175-
fi
150+
# Store the composite diff image.
151+
# Add the result to results.text
152+
echo $name $hash >$diff.fail
153+
# Threshold exceeded, save the diff and the original, current
154+
cp $diff-diff.png $DIFF/$name.png
155+
cp $diff-a.png $DIFF/$name'_'$ANAME.png
156+
cp $diff-b.png $DIFF/$name'_'$BNAME.png
157+
echo
158+
echo "Test: $name"
159+
echo " Image diff stored in $DIFF/$name.png"
160+
# $VIEWER "$diff-diff.png" "$diff-a.png" "$diff-b.png"
161+
# echo 'Hit return to process next image...'
162+
# read
176163
rm -f $diff-a.png $diff-b.png $diff-diff.png
177164
}
178165

@@ -245,5 +232,5 @@ then
245232
echo "You have $num_fails fail(s):"
246233
head -n $num_fails $RESULTS
247234
else
248-
echo "Success - All diffs under threshold!"
235+
echo "Success - No differences!"
249236
fi

0 commit comments

Comments
 (0)