diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2019-06-28 23:45:11 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2019-06-28 23:45:11 +0000 |
commit | cdf6e0151411d887fef61245cb303ef190b29335 (patch) | |
tree | 678c2212e125e66e0a868773e2b4ec460794da4e /test/pamenlarge-pbm.test | |
parent | de1311e820dc892f1a3c5c9ae70dbc56868030d8 (diff) | |
download | netpbm-mirror-cdf6e0151411d887fef61245cb303ef190b29335.tar.gz netpbm-mirror-cdf6e0151411d887fef61245cb303ef190b29335.tar.xz netpbm-mirror-cdf6e0151411d887fef61245cb303ef190b29335.zip |
Promote Advanced to Stable
git-svn-id: http://svn.code.sf.net/p/netpbm/code/stable@3641 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'test/pamenlarge-pbm.test')
-rwxr-xr-x | test/pamenlarge-pbm.test | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/test/pamenlarge-pbm.test b/test/pamenlarge-pbm.test new file mode 100755 index 00000000..10c00ba0 --- /dev/null +++ b/test/pamenlarge-pbm.test @@ -0,0 +1,61 @@ +#! /bin/bash +# This script tests: pamenlarge +# Also requires: pbmmake pnmpad + +tmpdir=${tmpdir:-/tmp} +complete256_pbm=${tmpdir}/complete256.pbm + +# works with gawk and mawk +# produce all possible 8-bit patterns + +LC_ALL=C awk 'BEGIN { print "P4"; # header + print "8 256"; + for (i=0;i<256;++i) # raster + printf("%c",i) }' > ${complete256_pbm} + +# xscale factor should be tested to at least 21 (=13+8) + +# Test 1. +echo "test 1" + +for xs in `seq 23` + do + pamenlarge -xscale=$xs ${complete256_pbm} | cksum + done + +# Test 2. +echo "test 2" + +for xs1 in `seq 15` + do + xs2=$((30-$xs1)) + pamenlarge -xscale=$xs1 ${complete256_pbm} | pamenlarge -xscale=$xs2 | cksum + if [ $xs1 != $xs2 ]; then + pamenlarge -xscale=$xs2 ${complete256_pbm} | pamenlarge -xscale=$xs1 | cksum + fi + pamenlarge -xscale=$(($xs1 * $xs2)) ${complete256_pbm} | cksum + done + +rm ${complete256_pbm} + +# Test 3. +echo "test 3" + +test3_pbm=${tmpdir}/test3.pbm + +for width in `seq 16` + do + pbmmake -g ${width} 1 | pnmpad -top=1 -white | \ + pnmpad -bottom=1 -black > ${test3_pbm}.${width} + done + + for xscale in `seq 16` + do echo -n ${xscale} " " + for width in `seq 16` + do pamenlarge -xscale=${xscale} ${test3_pbm}.${width} ; done | cksum + # + # unlike most other tests we take the cksum of a composite PBM file + # + done + +rm ${test3_pbm}.[1-9] ${test3_pbm}.1[1-6] \ No newline at end of file |