fukasawa e60969
#!/bin/sh
fukasawa e60969
#
fukasawa e60969
# Usage:
fukasawa e60969
#
fukasawa e60969
#  tests/pngstest gamma alpha
fukasawa e60969
#
fukasawa e60969
# Run ./pngstest on the PNG files in $srcdir/contrib/testpngs which have the
fukasawa e60969
# given gamma and opacity:
fukasawa e60969
#
fukasawa e60969
#  gamma: one of; linear, 1.8, sRGB, none.
fukasawa e60969
#  alpha: one of; opaque, tRNS, alpha, none.  'none' is equivalent to !alpha
fukasawa e60969
#
fukasawa e60969
# NOTE: the temporary files pngstest generates have the base name gamma-alpha to
fukasawa e60969
# avoid issues with make -j
fukasawa e60969
#
fukasawa e60969
gamma="$1"
fukasawa e60969
shift
fukasawa e60969
alpha="$1"
fukasawa e60969
shift
fukasawa e60969
exec ./pngstest --tmpfile "${gamma}-${alpha}-" --log ${1+"$@"} `
fukasawa e60969
   for f in "${srcdir}/contrib/testpngs/"*.png
fukasawa e60969
   do
fukasawa e60969
      g=
fukasawa e60969
      case "$f" in
fukasawa e60969
         *-linear[.-]*)
fukasawa e60969
            test "$gamma" = "linear" && g="$f";;
fukasawa e60969
fukasawa e60969
         *-sRGB[.-]*)
fukasawa e60969
            test "$gamma" = "sRGB" && g="$f";;
fukasawa e60969
fukasawa e60969
         *-1.8[.-]*)
fukasawa e60969
            test "$gamma" = "1.8" && g="$f";;
fukasawa e60969
fukasawa e60969
         *)
fukasawa e60969
            test "$gamma" = "none" && g="$f";;
fukasawa e60969
      esac
fukasawa e60969
fukasawa e60969
      case "$g" in
fukasawa e60969
         "")
fukasawa e60969
            :;;
fukasawa e60969
fukasawa e60969
         *-alpha[-.]*)
fukasawa e60969
            test "$alpha" = "alpha" && echo "$g";;
fukasawa e60969
fukasawa e60969
         *-tRNS[-.]*)
fukasawa e60969
            test "$alpha" = "tRNS" -o "$alpha" = "none" && echo "$g";;
fukasawa e60969
fukasawa e60969
         *)
fukasawa e60969
            test "$alpha" = "opaque" -o "$alpha" = "none" && echo "$g";;
fukasawa e60969
      esac
fukasawa e60969
   done
fukasawa e60969
`