3 cd $(dirname $0)/reference || exit
6 [ -n "$pdiff" ] || pdiff=../pdiff/perceptualdiff
7 if [ ! -e "${pdiff}" ]; then
8 echo "Error: requires pdiff executable"
12 for file in *.ref.png; do
13 test=$(echo $file | cut -d'.' -f1)
14 target=$(echo $file | cut -d'.' -f2)
15 format=$(echo $file | cut -d'.' -f3)
20 if [ $target = 'base' ]; then
21 # Ignore the base images for this script's purposes
23 elif [ $target = 'ref' ]; then
24 # This is actually the baseline reference image
26 elif [ $format = 'ref' ]; then
27 # This is either a format-specific reference, or a target-specific/format-generic image
28 # In either case, compare it against the generic reference image
31 # Prefer the target-specific/format-generic reference image, if available
32 ref="$test.$target.ref.png"
33 if [ ! -e $ref ]; then
34 ref="$test.$format.ref.png"
39 if [ $test = "create-from-png" ]; then
40 # The create-from-png test utilizes multiple reference images directly
42 elif [ $test = "fallback-resolution" ]; then
43 # The fallback-resolution test generates a set of reference images;
44 # These won't be redundant with one another, but just ignore them all.
49 if cmp --silent "$ref" "$file" ; then
50 printf "redundant: %s and %s are byte-by-byte identical files\n" $file $ref
52 # Run perceptualdiff with minimum threshold
53 pdiff_output=$($pdiff $ref $file -threshold 1)
54 result=${pdiff_output%:*}
55 notes=$(echo "${pdiff_output#*: }" | tail -n 1)
56 if [ "$result" = "PASS" ] && [ "$notes" = "Images are binary identical" ]; then
57 printf "redundant: %s and %s are pixel equivalent images\n" $file $ref