Chris Craik | ca2bf81 | 2013-07-29 15:28:30 -0700 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | # |
| 3 | # Usage: |
| 4 | # |
Matt Sarett | 96be908 | 2016-05-03 13:29:54 -0400 | [diff] [blame] | 5 | # tests/pngstest gamma alpha |
Chris Craik | ca2bf81 | 2013-07-29 15:28:30 -0700 | [diff] [blame] | 6 | # |
Matt Sarett | 96be908 | 2016-05-03 13:29:54 -0400 | [diff] [blame] | 7 | # Run ./pngstest on the PNG files in $srcdir/contrib/testpngs which have the |
| 8 | # given gamma and opacity: |
Chris Craik | ca2bf81 | 2013-07-29 15:28:30 -0700 | [diff] [blame] | 9 | # |
Matt Sarett | 96be908 | 2016-05-03 13:29:54 -0400 | [diff] [blame] | 10 | # gamma: one of; linear, 1.8, sRGB, none. |
| 11 | # alpha: one of; opaque, tRNS, alpha, none. 'none' is equivalent to !alpha |
| 12 | # |
| 13 | # NOTE: the temporary files pngstest generates have the base name gamma-alpha to |
| 14 | # avoid issues with make -j |
| 15 | # |
| 16 | gamma="$1" |
Chris Craik | ca2bf81 | 2013-07-29 15:28:30 -0700 | [diff] [blame] | 17 | shift |
Matt Sarett | 96be908 | 2016-05-03 13:29:54 -0400 | [diff] [blame] | 18 | alpha="$1" |
| 19 | shift |
| 20 | exec ./pngstest --tmpfile "${gamma}-${alpha}-" --log ${1+"$@"} $( |
| 21 | for f in "${srcdir}/contrib/testpngs/"*.png |
| 22 | do |
| 23 | g= |
| 24 | case "$f" in |
| 25 | *-linear[.-]*) |
| 26 | test "$gamma" = "linear" && g="$f";; |
| 27 | |
| 28 | *-sRGB[.-]*) |
| 29 | test "$gamma" = "sRGB" && g="$f";; |
| 30 | |
| 31 | *-1.8[.-]*) |
| 32 | test "$gamma" = "1.8" && g="$f";; |
| 33 | |
| 34 | *) |
| 35 | test "$gamma" = "none" && g="$f";; |
| 36 | esac |
| 37 | |
| 38 | case "$g" in |
| 39 | "") |
| 40 | :;; |
| 41 | |
| 42 | *-alpha[-.]*) |
| 43 | test "$alpha" = "alpha" && echo "$g";; |
| 44 | |
| 45 | *-tRNS[-.]*) |
| 46 | test "$alpha" = "tRNS" -o "$alpha" = "none" && echo "$g";; |
| 47 | |
| 48 | *) |
| 49 | test "$alpha" = "opaque" -o "$alpha" = "none" && echo "$g";; |
| 50 | esac |
| 51 | done |
| 52 | ) |