beta-0.89.2
[luatex.git] / source / libs / libpng / libpng-src / contrib / testpngs / makepngs.sh
blob81875871592c84bff07650684aba1e4dcdee318c
1 #!/bin/sh
3 # Make a set of test PNG files, MAKEPNG is the name of the makepng executable
4 # built from contrib/libtests/makepng.c
6 # Copyright (c) 2015 John Cunningham Bowler
8 # Last changed in libpng 1.7.0 [(PENDING RELEASE)]
10 # This code is released under the libpng license.
11 # For conditions of distribution and use, see the disclaimer
12 # and license in png.h
14 # The arguments say whether to build all the files or whether just to build the
15 # ones that extend the code-coverage of libpng from the existing test files in
16 # contrib/pngsuite.
17 test -n "$MAKEPNG" || MAKEPNG=./makepng
18 opts=
20 mp(){
21 ${MAKEPNG} $opts $1 "$3" "$4" "$3-$4$2.png"
24 mpg(){
25 if test "$1" = "none"
26 then
27 mp "" "" "$2" "$3"
28 else
29 mp "--$1" "-$1" "$2" "$3"
33 mptrans(){
34 if test "$1" = "none"
35 then
36 mp "--tRNS" "-tRNS" "$2" "$3"
37 else
38 mp "--tRNS --$1" "-$1-tRNS" "$2" "$3"
42 case "$1" in
43 --small)
44 opts="--small";;&
46 --all|--small)
47 for g in none sRGB linear 1.8
49 for c in gray palette
51 for b in 1 2 4
53 mpg "$g" "$c" "$b"
54 mptrans "$g" "$c" "$b"
55 done
56 done
58 mpg "$g" palette 8
59 mptrans "$g" palette 8
61 for b in 8 16
63 for c in gray gray-alpha rgb rgb-alpha
65 mpg "$g" "$c" "$b"
66 done
67 for c in gray rgb
69 mptrans "$g" "$c" "$b"
70 done
71 done
72 done;;
74 --coverage)
75 # Comments below indicate cases known to be required and not duplicated
76 # in other (required) cases; the aim is to get a minimal set that gives
77 # the maxium code coverage.
78 mpg none gray-alpha 8 # required: code coverage, sRGB opaque component
79 mpg none palette 8 # required: basic palette read
80 mpg 1.8 gray 2 # required: tests gamma threshold code
81 mpg 1.8 palette 2 # required: code coverage
82 mpg 1.8 palette 4 # required: code coverage
83 mpg 1.8 palette 8 # error limits only
84 mpg linear palette 8 # error limits only
85 mpg linear rgb-alpha 16 # error limits only
86 mpg sRGB palette 1 # required: code coverage
87 mpg sRGB rgb-alpha 16 # required: code coverage: pngread.c:2422 untested
88 :;;
91 echo "$0 $1: unknown argument, usage:" >&2
92 echo " $0 [--all|--coverage|--small]" >&2
93 exit 1
94 esac