2013-03-02 15:58:22 -05:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Usage:
|
|
|
|
#
|
2015-09-25 15:21:10 -04:00
|
|
|
# tests/pngstest gamma alpha
|
2013-03-02 15:58:22 -05:00
|
|
|
#
|
2015-09-25 15:21:10 -04:00
|
|
|
# Run ./pngstest on the PNG files in $srcdir/contrib/testpngs which have the
|
|
|
|
# given gamma and opacity:
|
2013-03-02 15:58:22 -05:00
|
|
|
#
|
2015-09-25 15:21:10 -04:00
|
|
|
# gamma: one of; linear, 1.8, sRGB, none.
|
|
|
|
# alpha: one of; opaque, tRNS, alpha, none. 'none' is equivalent to !alpha
|
|
|
|
#
|
|
|
|
# NOTE: the temporary files pngstest generates have the base name gamma-alpha to
|
|
|
|
# avoid issues with make -j
|
|
|
|
#
|
|
|
|
gamma="$1"
|
|
|
|
shift
|
|
|
|
alpha="$1"
|
2013-03-02 15:58:22 -05:00
|
|
|
shift
|
2016-01-29 02:10:04 -05:00
|
|
|
args=
|
|
|
|
LC_ALL="C" # fix glob sort order to ASCII:
|
|
|
|
for f in "${srcdir}/contrib/testpngs/"*.png
|
|
|
|
do
|
|
|
|
g=
|
|
|
|
case "$f" in
|
|
|
|
*-linear[.-]*)
|
|
|
|
test "$gamma" = "linear" && g="$f";;
|
2015-09-25 15:21:10 -04:00
|
|
|
|
2016-01-29 02:10:04 -05:00
|
|
|
*-sRGB[.-]*)
|
|
|
|
test "$gamma" = "sRGB" && g="$f";;
|
2015-09-25 15:21:10 -04:00
|
|
|
|
2016-01-29 02:10:04 -05:00
|
|
|
*-1.8[.-]*)
|
|
|
|
test "$gamma" = "1.8" && g="$f";;
|
2015-09-25 15:21:10 -04:00
|
|
|
|
2016-01-29 02:10:04 -05:00
|
|
|
*)
|
|
|
|
test "$gamma" = "none" && g="$f";;
|
|
|
|
esac
|
2015-09-25 15:21:10 -04:00
|
|
|
|
2016-01-29 02:10:04 -05:00
|
|
|
case "$g" in
|
|
|
|
"")
|
|
|
|
:;;
|
2015-09-25 15:21:10 -04:00
|
|
|
|
2016-01-29 02:10:04 -05:00
|
|
|
*-alpha[-.]*)
|
|
|
|
test "$alpha" = "alpha" && args="$args $g";;
|
2015-09-25 15:21:10 -04:00
|
|
|
|
2016-01-29 02:10:04 -05:00
|
|
|
*-tRNS[-.]*)
|
|
|
|
test "$alpha" = "tRNS" -o "$alpha" = "none" && args="$args $g";;
|
2015-09-25 15:21:10 -04:00
|
|
|
|
2016-01-29 02:10:04 -05:00
|
|
|
*)
|
|
|
|
test "$alpha" = "opaque" -o "$alpha" = "none" && args="$args $g";;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
# This only works if the arguments don't contain spaces; they don't.
|
|
|
|
exec ./pngstest --tmpfile "${gamma}-${alpha}-" --log ${1+"$@"} $args
|