fukasawa e60969
#!/bin/sh
fukasawa e60969
#
fukasawa e60969
# Make a set of test PNG files, MAKEPNG is the name of the makepng executable
fukasawa e60969
# built from contrib/libtests/makepng.c
fukasawa e60969
fukasawa e60969
# Copyright (c) 2015 John Cunningham Bowler
fukasawa e60969
fukasawa e60969
# Last changed in libpng 1.7.0 [(PENDING RELEASE)]
fukasawa e60969
fukasawa e60969
# This code is released under the libpng license.
fukasawa e60969
# For conditions of distribution and use, see the disclaimer
fukasawa e60969
# and license in png.h
fukasawa e60969
fukasawa e60969
# The arguments say whether to build all the files or whether just to build the
fukasawa e60969
# ones that extend the code-coverage of libpng from the existing test files in
fukasawa e60969
# contrib/pngsuite.
fukasawa e60969
test -n "$MAKEPNG" || MAKEPNG=./makepng
fukasawa e60969
opts=
fukasawa e60969
fukasawa e60969
mp(){
fukasawa e60969
   ${MAKEPNG} $opts $1 "$3" "$4" "$3-$4$2.png"
fukasawa e60969
}
fukasawa e60969
fukasawa e60969
mpg(){
fukasawa e60969
   if test "$1" = "none"
fukasawa e60969
   then
fukasawa e60969
      mp "" "" "$2" "$3"
fukasawa e60969
   else
fukasawa e60969
      mp "--$1" "-$1" "$2" "$3"
fukasawa e60969
   fi
fukasawa e60969
}
fukasawa e60969
fukasawa e60969
mptrans(){
fukasawa e60969
   if test "$1" = "none"
fukasawa e60969
   then
fukasawa e60969
      mp "--tRNS" "-tRNS" "$2" "$3"
fukasawa e60969
   else
fukasawa e60969
      mp "--tRNS --$1" "-$1-tRNS" "$2" "$3"
fukasawa e60969
   fi
fukasawa e60969
}
fukasawa e60969
fukasawa e60969
case "$1" in
fukasawa e60969
   --small)
fukasawa e60969
      opts="--small";;&
fukasawa e60969
fukasawa e60969
   --all|--small)
fukasawa e60969
      for g in none sRGB linear 1.8
fukasawa e60969
      do
fukasawa e60969
         for c in gray palette
fukasawa e60969
         do
fukasawa e60969
            for b in 1 2 4
fukasawa e60969
            do
fukasawa e60969
               mpg "$g" "$c" "$b"
fukasawa e60969
               mptrans "$g" "$c" "$b"
fukasawa e60969
            done
fukasawa e60969
         done
fukasawa e60969
fukasawa e60969
         mpg "$g" palette 8
fukasawa e60969
         mptrans "$g" palette 8
fukasawa e60969
fukasawa e60969
         for b in 8 16
fukasawa e60969
         do
fukasawa e60969
            for c in gray gray-alpha rgb rgb-alpha
fukasawa e60969
            do
fukasawa e60969
               mpg "$g" "$c" "$b"
fukasawa e60969
            done
fukasawa e60969
            for c in gray rgb
fukasawa e60969
            do
fukasawa e60969
               mptrans "$g" "$c" "$b"
fukasawa e60969
            done
fukasawa e60969
         done
fukasawa e60969
      done;;
fukasawa e60969
fukasawa e60969
   --coverage)
fukasawa e60969
      # Comments below indicate cases known to be required and not duplicated
fukasawa e60969
      # in other (required) cases; the aim is to get a minimal set that gives
fukasawa e60969
      # the maxium code coverage.
fukasawa e60969
      mpg none gray-alpha 8 # required: code coverage, sRGB opaque component
fukasawa e60969
      mpg none palette 8 # required: basic palette read
fukasawa e60969
      mpg 1.8 gray 2 # required: tests gamma threshold code
fukasawa e60969
      mpg 1.8 palette 2 # required: code coverage
fukasawa e60969
      mpg 1.8 palette 4 # required: code coverage
fukasawa e60969
      mpg 1.8 palette 8 # error limits only
fukasawa e60969
      mpg linear palette 8 # error limits only
fukasawa e60969
      mpg linear rgb-alpha 16 # error limits only
fukasawa e60969
      mpg sRGB palette 1 # required: code coverage
fukasawa e60969
      mpg sRGB rgb-alpha 16 # required: code coverage: pngread.c:2422 untested
fukasawa e60969
      :;;
fukasawa e60969
fukasawa e60969
   *)
fukasawa e60969
      echo "$0 $1: unknown argument, usage:" >&2
fukasawa e60969
      echo "  $0 [--all|--coverage|--small]" >&2
fukasawa e60969
      exit 1
fukasawa e60969
esac