1#!/bin/sh 2# 3# Make a set of test PNG files, MAKEPNG is the name of the makepng executable 4# built from contrib/libtests/makepng.c 5 6# Copyright (c) 2015 John Cunningham Bowler 7 8# Last changed in libpng 1.6.20 [December 3, 2015] 9 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 13 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. 17test -n "$MAKEPNG" || MAKEPNG=./makepng 18opts= 19 20mp(){ 21 ${MAKEPNG} $opts $1 "$3" "$4" "$3-$4$2.png" 22} 23 24mpg(){ 25 if test "$1" = "none" 26 then 27 mp "" "" "$2" "$3" 28 else 29 mp "--$1" "-$1" "$2" "$3" 30 fi 31} 32 33mptrans(){ 34 if test "$1" = "none" 35 then 36 mp "--tRNS" "-tRNS" "$2" "$3" 37 else 38 mp "--tRNS --$1" "-$1-tRNS" "$2" "$3" 39 fi 40} 41 42case "$1" in 43 --small) 44 opts="--small";;& 45 46 --all|--small) 47 for g in none sRGB linear 1.8 48 do 49 for c in gray palette 50 do 51 for b in 1 2 4 52 do 53 mpg "$g" "$c" "$b" 54 mptrans "$g" "$c" "$b" 55 done 56 done 57 58 mpg "$g" palette 8 59 mptrans "$g" palette 8 60 61 for b in 8 16 62 do 63 for c in gray gray-alpha rgb rgb-alpha 64 do 65 mpg "$g" "$c" "$b" 66 done 67 for c in gray rgb 68 do 69 mptrans "$g" "$c" "$b" 70 done 71 done 72 done;; 73 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 maximum 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 :;; 89 90 *) 91 echo "$0 $1: unknown argument, usage:" >&2 92 echo " $0 [--all|--coverage|--small]" >&2 93 exit 1 94esac 95