pngstest 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/bin/sh
  2. #
  3. # Usage:
  4. #
  5. # tests/pngstest gamma alpha
  6. #
  7. # Run ./pngstest on the PNG files in $srcdir/contrib/testpngs which have the
  8. # given gamma and opacity:
  9. #
  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"
  17. shift
  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. *-sRGB[.-]*)
  28. test "$gamma" = "sRGB" && g="$f";;
  29. *-1.8[.-]*)
  30. test "$gamma" = "1.8" && g="$f";;
  31. *)
  32. test "$gamma" = "none" && g="$f";;
  33. esac
  34. case "$g" in
  35. "")
  36. :;;
  37. *-alpha[-.]*)
  38. test "$alpha" = "alpha" && echo "$g";;
  39. *-tRNS[-.]*)
  40. test "$alpha" = "tRNS" -o "$alpha" = "none" && echo "$g";;
  41. *)
  42. test "$alpha" = "opaque" -o "$alpha" = "none" && echo "$g";;
  43. esac
  44. done
  45. )