File: pngstest

package info (click to toggle)
libpng1.6 1.6.37-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 8,684 kB
  • sloc: ansic: 58,090; sh: 4,974; awk: 782; makefile: 576; asm: 205; cpp: 135
file content (54 lines) | stat: -rwxr-xr-x 1,247 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/sh
#
# Usage:
#
#  tests/pngstest gamma alpha
#
# Run ./pngstest on the PNG files in $srcdir/contrib/testpngs which have the
# given gamma and opacity:
#
#  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"
shift
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";;

      *-sRGB[.-]*)
         test "$gamma" = "sRGB" && g="$f";;

      *-1.8[.-]*)
         test "$gamma" = "1.8" && g="$f";;

      *)
         test "$gamma" = "none" && g="$f";;
   esac

   case "$g" in
      "")
         :;;

      *-alpha[-.]*)
         test "$alpha" = "alpha" && args="$args $g";;

      *-tRNS[-.]*)
         test "$alpha" = "tRNS" -o "$alpha" = "none" && args="$args $g";;

      *)
         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