diff options
Diffstat (limited to 'test')
-rwxr-xr-x | test/Execute-Tests | 3 | ||||
-rw-r--r-- | test/Test-Order | 7 | ||||
-rw-r--r-- | test/all-in-place.ok | 1 | ||||
-rwxr-xr-x | test/all-in-place.test | 34 | ||||
-rw-r--r-- | test/g3-roundtrip.ok | 7 | ||||
-rwxr-xr-x | test/g3-roundtrip.test | 38 | ||||
-rwxr-xr-x | test/legacy-names.test | 21 | ||||
-rw-r--r-- | test/pamgauss.ok (renamed from test/ppmgauss.ok) | 72 | ||||
-rwxr-xr-x | test/pamgauss.test (renamed from test/ppmgauss.test) | 2 | ||||
-rw-r--r-- | test/pamtable.ok | 66 | ||||
-rwxr-xr-x | test/pamtable.test | 20 | ||||
-rw-r--r-- | test/pbmtog3.ok | 1 | ||||
-rwxr-xr-x | test/pbmtog3.test | 10 | ||||
-rw-r--r-- | test/ppmpat-random.ok | 3 | ||||
-rwxr-xr-x | test/ppmpat-random.test | 30 | ||||
-rw-r--r-- | test/ppmpat.ok | 6 | ||||
-rwxr-xr-x | test/ppmpat.test | 38 | ||||
-rw-r--r-- | test/symmetry.ok | 6 | ||||
-rwxr-xr-x | test/symmetry.test | 8 | ||||
-rw-r--r-- | test/tiff-flate-lzw-roundtrip.ok | 12 | ||||
-rwxr-xr-x | test/tiff-flate-lzw-roundtrip.test | 23 | ||||
-rw-r--r-- | test/tiff-roundtrip.ok | 30 | ||||
-rwxr-xr-x | test/tiff-roundtrip.test | 85 | ||||
-rw-r--r-- | test/tiffcmyk-roundtrip.ok | 5 | ||||
-rwxr-xr-x | test/tiffcmyk-roundtrip.test | 46 |
25 files changed, 462 insertions, 112 deletions
diff --git a/test/Execute-Tests b/test/Execute-Tests index 39d6a5d1..bf8ecb56 100755 --- a/test/Execute-Tests +++ b/test/Execute-Tests @@ -180,7 +180,8 @@ elif [ $VALGRIND_TESTS = "on" ] vg_command_base="valgrind --trace-children=yes"; for i in awk cat cksum cmp cp cut date dirname egrep fgrep file grep gs \ - head mkdir mktemp perl rm sed seq sh tee testrandom tr uniq + head mkdir mktemp perl rm sed seq sh tee testrandom tr uniq \ + Available-Testprog # Tell valgrind not to probe execution of the above programs. diff --git a/test/Test-Order b/test/Test-Order index 8c5a7aae..d67c7f29 100644 --- a/test/Test-Order +++ b/test/Test-Order @@ -14,21 +14,23 @@ pbmpage.test pbmtext.test pbmupc.test pgmramp.test -ppmgauss.test +pamgauss.test ppmcie.test ppmwheel.test pamcrater.test +ppmpat.test # Generators with random components pgmnoise.test -ppmpat.test +ppmpat-random.test ppmforge.test ppmrough.test # Analyzer tests pamfile.test +pamtable.test pgmhist.test ppmhist.test pamsumm.test @@ -159,4 +161,5 @@ xwd-roundtrip.test fiasco-roundtrip.test jpeg-roundtrip.test +tiffcmyk-roundtrip.test yuv-roundtrip.test diff --git a/test/all-in-place.ok b/test/all-in-place.ok index 2fe1ed52..b9db6ee1 100644 --- a/test/all-in-place.ok +++ b/test/all-in-place.ok @@ -82,6 +82,7 @@ pamstretch: ok pamstretch-gen: ok pamsumm: ok pamsummcol: ok +pamtable: ok pamthreshold: ok pamtilt: ok pamtoavs: ok diff --git a/test/all-in-place.test b/test/all-in-place.test index 1cdae7f6..52d38bcf 100755 --- a/test/all-in-place.test +++ b/test/all-in-place.test @@ -124,6 +124,7 @@ ordinary_testprogs="\ pamstretch-gen \ pamsumm \ pamsummcol \ + pamtable \ pamthreshold \ pamtilt \ pamtoavs \ @@ -368,9 +369,17 @@ ordinary_testprogs="\ " -# The string "fiascotopnm" has to be filtered out by egrep for fiascotopnm +# The string "fiascotopnm" has to be filtered out by fgrep for fiascotopnm # has a slightly different version report format. +# Switch to control output from "program --version" +# +grepSwitch=1 # Initial value + # Always 1 for check-install, + # otherwise changes to 0 once a command succeeds. +grepOption[0]="-v" # Suppress output +grepOption[1]="" # Output --version message + for i in $ordinary_testprogs do # Stub out programs that aren't built. @@ -381,11 +390,24 @@ for i in $ordinary_testprogs continue fi - $i --version 2>&1 | \ - egrep -v -e fiascotopnm -e \ - "(Using libnetpbm|Compiled|(BSD|SYSV|MSDOS|AMIGA) defined|RGB_?ENV=)" \ - 1>&2; - testExitStatus $i 0 ${PIPESTATUS[0]} + + $i --version < /dev/null 2>&1 | \ + # Older versions of pamstretch-gen and ppmshadow (encountered when + # one does "make check-install") get stuck when there is no input. + # Supply /dev/null as input to placate these programs. + + egrep -v -e "fiascotopnm" -e \ + ": ((BSD|SYSV|MSDOS|AMIGA) defined|RGB_?ENV=)" | \ + egrep ${grepOption[$grepSwitch]} -e \ + ": (Using lib(net)?pbm|(Built (by|at)|Compiled ))" 1>&2; + # See showVersion() in lib/libpm.c for the above regular expressions. + + exitStatus=${PIPESTATUS[0]} + testExitStatus $i 0 ${exitStatus} + + if [ ${CHECK_TYPE} != "install" ] + then grepSwitch=$((${grepSwitch} * ${exitStatus})) ; + fi done diff --git a/test/g3-roundtrip.ok b/test/g3-roundtrip.ok index bb0b1cf6..4521d575 100644 --- a/test/g3-roundtrip.ok +++ b/test/g3-roundtrip.ok @@ -1,3 +1,10 @@ 0 0 0 +0 +0 +0 +0 +0 +0 +0 diff --git a/test/g3-roundtrip.test b/test/g3-roundtrip.test index 47e20e1d..baa6ac31 100755 --- a/test/g3-roundtrip.test +++ b/test/g3-roundtrip.test @@ -2,6 +2,10 @@ # This script tests: g3topbm pbmtog3 # Also requires: pnmcrop +tmpdir=${tmpdir:-/tmp} +complete256_pbm=${tmpdir}/complete256.pbm +widew_pbm=${tmpdir}/widew.pbm +wideb_pbm=${tmpdir}/wideb.pbm pbmtog3 -nofixedwidth testgrid.pbm | \ g3topbm -width=14 | cmp -s - testgrid.pbm @@ -14,3 +18,37 @@ echo $? pbmtog3 testgrid.pbm | \ g3topbm | pnmcrop -white -right -bottom | \ cmp -s - testgrid.pbm ; echo $? + +awk 'BEGIN { print "P4"; # header + print "8 256"; + for (i=0;i<256;++i) # raster + printf("%c",i) }' > ${complete256_pbm} + +pbmtog3 -nofixedwidth ${complete256_pbm} | g3topbm -width=8 | tee /tmp/z1 | \ + cmp -s - ${complete256_pbm} ; echo $? + +pbmtog3 -reverse -nofixedwidth ${complete256_pbm} | \ +g3topbm -reversebits -width=8 | \ + cmp -s - ${complete256_pbm} ; echo $? + +pbmtog3 -align8 ${complete256_pbm} | \ +g3topbm -width=1728 | pnmcrop -white -right | \ + cmp -s - ${complete256_pbm} ; echo $? + +pbmtog3 -align16 ${complete256_pbm} | \ +g3topbm -width=1728 | pnmcrop -white -right | \ + cmp -s - ${complete256_pbm} ; echo $? + +pbmmake -w 5000 5 | tee ${widew_pbm} | pbmtog3 -nofixedwidth | \ +g3topbm | \ + cmp -s - ${widew_pbm} ; echo $? + +pbmtog3 -nofixedwidth ${widew_pbm} | \ +g3topbm -width=5000 | \ + cmp -s - ${widew_pbm} ; echo $? + +pbmmake -b 5000 5 | tee ${wideb_pbm} | pbmtog3 -nofixedwidth | \ +g3topbm | \ + cmp -s - ${wideb_pbm} ; echo $? + +rm ${complete256_pbm} ${wideb_pbm} ${widew_pbm} diff --git a/test/legacy-names.test b/test/legacy-names.test index 46bc9ee4..5a65615f 100755 --- a/test/legacy-names.test +++ b/test/legacy-names.test @@ -94,6 +94,13 @@ ordinary_testprogs="\ ppmtouil \ " +# Switch to control output from "program --version" +# See comments in all-in-place.test + +if [ ${CHECK_TYPE} = "install" ] + then grepOption[1]="" ; # Output --version message + else grepOption[0]="-v" ; # Suppress output +fi for i in $ordinary_testprogs do @@ -105,11 +112,15 @@ for i in $ordinary_testprogs continue fi - $i --version 2>&1 | \ - egrep -v \ - "(Using libnetpbm|Compiled|(BSD|SYSV|MSDOS|AMIGA) defined|RGB_?ENV=)" \ - 1>&2; - testExitStatus $i 0 ${PIPESTATUS[0]} + $i --version < /dev/null 2>&1 | \ + egrep -v -e "fiascotopnm" -e \ + ": ((BSD|SYSV|MSDOS|AMIGA) defined|RGB_?ENV=)" | \ + egrep ${grepOption[$grepSwitch]} -e \ + ": (Using lib(net)?pbm|(Built (by|at)|Compiled ))" 1>&2; + # See showVersion() in lib/libpm.c for the above regular expressions. + + exitStatus=${PIPESTATUS[0]} + testExitStatus $i 0 ${exitStatus} done diff --git a/test/ppmgauss.ok b/test/pamgauss.ok index cf708d64..153d4f6e 100644 --- a/test/ppmgauss.ok +++ b/test/pamgauss.ok @@ -7,15 +7,15 @@ 171732531 55 448293386 55 3030522957 55 -757204806 62 -757204806 62 -2890088558 62 -4276668903 62 -1462902064 62 -4161772187 62 -2741154810 62 -417660035 62 -1026188683 62 +1912396937 62 +1912396937 62 +1912396937 62 +1912396937 62 +924437833 62 +2403224870 62 +1828243243 62 +3189486374 62 +3077695768 62 1236982144 71 1236982144 71 2668915323 71 @@ -25,15 +25,15 @@ 1741784255 71 2975827721 71 185899480 71 -1890880170 82 -1890880170 82 -2007282168 82 -2290578407 82 -3295586348 82 -3202728672 82 -3794283497 82 -1136760947 82 -2659761303 82 +685596179 82 +685596179 82 +685596179 82 +685596179 82 +3959781759 82 +3753883586 82 +3706474367 82 +2091709635 82 +651233877 82 3268058875 95 3268058875 95 4112134785 95 @@ -43,15 +43,15 @@ 3042873446 95 299128630 95 1852505233 95 -3614879265 110 -3614879265 110 -3727088180 110 -3861671574 110 -952180714 110 -1393452065 110 -1551903756 110 -2198775655 110 -3231547603 110 +2257309933 110 +2257309933 110 +2257309933 110 +2257309933 110 +3861656488 110 +130820705 110 +1706835660 110 +4285051006 110 +285426992 110 3184597171 127 3184597171 127 406519147 127 @@ -61,15 +61,15 @@ 1852779549 127 1734420920 127 2400421918 127 -3252995941 148 -3252995941 148 -2022176119 148 -473753498 148 -3178129210 148 -2278608777 148 -3169785704 148 -85136480 148 -2396646133 148 +3247957822 148 +3247957822 148 +3247957822 148 +3247957822 148 +3407897457 148 +1176192530 148 +3551192353 148 +557209968 148 +2437783856 148 1871459418 169 1871459418 169 639002491 169 diff --git a/test/ppmgauss.test b/test/pamgauss.test index 213810c7..b48517c4 100755 --- a/test/ppmgauss.test +++ b/test/pamgauss.test @@ -7,6 +7,6 @@ for i in `seq 3 11` do for s in `seq 1 9` do -pamgauss $i $i -sigma=.$s | cksum +pamgauss $i $i -oversample=1 -sigma=.$s | cksum done done diff --git a/test/pamtable.ok b/test/pamtable.ok new file mode 100644 index 00000000..c8db6002 --- /dev/null +++ b/test/pamtable.ok @@ -0,0 +1,66 @@ +0 1 0 1 0 1 0 1 0 1 0 1 0 1 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 1 0 1 0 1 0 1 0 1 0 1 0 1 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 1 0 1 0 1 0 1 0 1 0 1 0 1 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 1 0 1 0 1 0 1 0 1 0 1 0 1 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 1 0 1 0 1 0 1 0 1 0 1 0 1 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 1 0 1 0 1 0 1 0 1 0 1 0 1 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 1 0 1 0 1 0 1 0 1 0 1 0 1 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 1 0 1 0 1 0 1 0 1 0 1 0 1 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 + +0 0 0|0 0 1|0 0 2|0 1 0|0 1 1|0 1 2|0 2 0|0 2 1|0 2 2|1 0 0|1 0 1|1 0 2|1 1 0|1 1 1|1 1 2|1 2 0|1 2 1|1 2 2|2 0 0|2 0 1|2 0 2|2 1 0|2 1 1|2 1 2|2 2 0|2 2 1|2 2 2 + +0 0 0 0|0 0 0 1|0 0 1 0|0 0 1 1|0 1 0 0|0 1 0 1|0 1 1 0|0 1 1 1|1 0 0 0|1 0 0 1|1 0 1 0|1 0 1 1|1 1 0 0|1 1 0 1|1 1 1 0|1 1 1 1 + +9 0 +0 9 + +0 0 0|4 4 4|9 9 9 +0 0 0|4 4 4|9 9 9 + +9 0 0|0 0 9|0 0 9|0 9 0 +9 0 0|0 0 9|0 0 9|0 9 0 + +10 0 + 0 10 + + 0 0 0| 5 5 5|10 10 10 + 0 0 0| 5 5 5|10 10 10 + +10 0 0| 0 0 10| 0 0 10| 0 10 0 +10 0 0| 0 0 10| 0 0 10| 0 10 0 + +9999 0 + 0 9999 + + 0 0 0|4980 4980 4980|9999 9999 9999 + 0 0 0|4980 4980 4980|9999 9999 9999 + +9999 0 0| 0 0 9999| 0 0 9999| 0 9999 0 +9999 0 0| 0 0 9999| 0 0 9999| 0 9999 0 + +10000 0 + 0 10000 + + 0 0 0| 4980 4980 4980|10000 10000 10000 + 0 0 0| 4980 4980 4980|10000 10000 10000 + +10000 0 0| 0 0 10000| 0 0 10000| 0 10000 0 +10000 0 0| 0 0 10000| 0 0 10000| 0 10000 0 + +65535 0 + 0 65535 + + 0 0 0|32639 32639 32639|65535 65535 65535 + 0 0 0|32639 32639 32639|65535 65535 65535 + +65535 0 0| 0 0 65535| 0 0 65535| 0 65535 0 +65535 0 0| 0 0 65535| 0 0 65535| 0 65535 0 + diff --git a/test/pamtable.test b/test/pamtable.test new file mode 100755 index 00000000..5c66b7ae --- /dev/null +++ b/test/pamtable.test @@ -0,0 +1,20 @@ +#! /bin/bash +# This script tests: pamtable +# Also requires: pamgradient pamseq pamdepth + +pamtable testgrid.pbm +echo +pamseq 3 2 -tupletype=RGB | pamtable +echo +pamseq 4 1 -tupletype=RGBA | pamtable +echo +for maxval in 9 10 9999 10000 65535 + do pbmmake -g 2 2 | pamdepth $maxval | pamtable + echo + ppmrainbow -width=3 -height=2 -norepeat black white | \ + pamdepth $maxval | pamtable + echo + ppmrainbow -width=4 -height=2 -norepeat red blue green | \ + pamdepth $maxval | pamtable + echo + done diff --git a/test/pbmtog3.ok b/test/pbmtog3.ok index a0768f95..cef9e3f9 100644 --- a/test/pbmtog3.ok +++ b/test/pbmtog3.ok @@ -5,7 +5,6 @@ 28792587 47 277456854 32 28792587 47 -871281767 162 3736247115 62 2820255307 2191856 4159089282 2226575 diff --git a/test/pbmtog3.test b/test/pbmtog3.test index 15c0cdf9..c5dc3357 100755 --- a/test/pbmtog3.test +++ b/test/pbmtog3.test @@ -2,7 +2,6 @@ # This script tests: pbmtog3 # Also requires: pbmmake - # Test 1. Should print 3697098186 144 pbmtog3 testgrid.pbm | cksum # Test 2. Should print 1248301383 122 @@ -18,12 +17,9 @@ pbmmake -w 10 10 | \ pbmtog3 -nofixedwidth | cksum # Test 7. Should print 28792587 47 pbmmake -w 10000 10 | pbmtog3 | cksum -# Test 8. Should print 871281767 162 -pbmmake -w 10000 10 | \ - pbmtog3 -nofixedwidth | cksum -# Test 9. Should print 3736247115 62 +# Test 8. Should print 3736247115 62 pbmmake -b 10 10 | pbmtog3 | cksum -# Test 10. Should print 2820255307 2191856 +# Test 9. Should print 2820255307 2191856 pbmmake -g 1700 2286 | pbmtog3 | cksum -# Test 11. Should print 4159089282 2226575 +# Test 10. Should print 4159089282 2226575 pbmmake -g 1800 2286 | pbmtog3 | cksum diff --git a/test/ppmpat-random.ok b/test/ppmpat-random.ok new file mode 100644 index 00000000..4d298cec --- /dev/null +++ b/test/ppmpat-random.ok @@ -0,0 +1,3 @@ +2219119109 36015 +3436846137 16813 +908097729 16813 diff --git a/test/ppmpat-random.test b/test/ppmpat-random.test new file mode 100755 index 00000000..d9f69c18 --- /dev/null +++ b/test/ppmpat-random.test @@ -0,0 +1,30 @@ +#! /bin/bash +# This script tests: ppmpat +# Also requires: + +# TODO: Write tests for squig and poles. It appears that they are +# sensitive to differences in floating point math. + +# These tests require random numbers. + +testrandom -q +case $? in + 81) + # Test 1. Should print: 2219119109 36015 + ppmpat --randomseed=0 -camo 100 120 | cksum + + # Test 2. Should print: 3436846137 16813 + ppmpat --randomseed=0 -anticamo 80 70 | cksum + + # Test 3. Should print: 908097729 16813 + ppmpat --randomseed=0 --color \ + rgb:55/c0/34,rgb:0/ff/0,rgb:0/ee/0,rgb:0/cd/0,rgb:0/8b/0,rgb:4f/4f/2f \ + -camo 80 70 | cksum + ;; + + 8[02-9] | 90) + echo "Skipping: random number generator is not glibc." 1>&2 + exit 80;; + + *) exit 1;; # testrandom failed +esac diff --git a/test/ppmpat.ok b/test/ppmpat.ok index c5b71909..bb940aee 100644 --- a/test/ppmpat.ok +++ b/test/ppmpat.ok @@ -1,6 +1,6 @@ 4008533639 781 -2448908863 9613 +3805937800 9613 2698433077 1549 3705929501 781 -2219119109 36015 -3436846137 16813 +3057513592 661 +1861389287 661 diff --git a/test/ppmpat.test b/test/ppmpat.test index 89f86f67..cd00c0f1 100755 --- a/test/ppmpat.test +++ b/test/ppmpat.test @@ -2,34 +2,20 @@ # This script tests: ppmpat # Also requires: -# TODO: Write tests for squig and poles. It appears that they are -# sensitive to differences in floating point math. +# Test 1. Should print: 4008533639 781 +ppmpat -g2 --color=rgb:32/0d/b7,rgb:31/58/a3 16 16 | cksum -testrandom -q -case $? in - 81) - # Test 1. Should print: 4008533639 781 - ppmpat --randomseed=0 -g2 16 16 | cksum +# Test 2. Should print: 3805937800 9613 +ppmpat -g3 --color=rgb:32/0d/b7,rgb:31/58/a3,rgb:e9/5e/d4 64 50 | cksum - # Test 2. Should print: 2448908863 9613 - ppmpat --randomseed=0 -g2 64 50 | cksum +# Test 3. Should print: 2698433077 1549 +ppmpat -madras --color=rgb:32/0d/b7,rgb:31/58/a3,rgb:e9/5e/d4 32 16 | cksum - # Test 3. Should print: 2698433077 1549 - ppmpat --randomseed=0 -madras 32 16 | cksum +# Test 4. Should print: 3705929501 781 +ppmpat -tartan --color=rgb:32/0d/b7,rgb:31/58/a3,rgb:e9/5e/d4 16 16 | cksum - # Test 4. Should print: 3705929501 781 - ppmpat --randomseed=0 -tartan 16 16 | cksum +# Test 5. Should print: 3057513592 661 +ppmpat -argyle1 --color=rgb:ff/ff/ff,rgb:ff/0/0 12 18 | cksum - # Test 5. Should print: 2219119109 36015 - ppmpat --randomseed=0 -camo 100 120 | cksum - - # Test 6. Should print: 3436846137 16813 - ppmpat --randomseed=0 -anticamo 80 70 | cksum - ;; - - 8[02-9] | 90) - echo "Skipping: random number generator is not glibc." 1>&2 - exit 80;; - - *) exit 1;; # testrandom failed -esac +# Test 6. Should print: 1861389287 661 +ppmpat -argyle2 --color=rgb:00/00/00,rgb:ff/80/80,rgb:e0/e0/e0 12 18 | cksum diff --git a/test/symmetry.ok b/test/symmetry.ok index 23129684..a5945014 100644 --- a/test/symmetry.ok +++ b/test/symmetry.ok @@ -10,3 +10,9 @@ ok ok ok ok +ok +ok +ok +ok +ok +ok diff --git a/test/symmetry.test b/test/symmetry.test index e6a6b654..52ba6388 100755 --- a/test/symmetry.test +++ b/test/symmetry.test @@ -48,9 +48,11 @@ pgmramp -ell 63 63 > ${circle_pgm} rm ${circle_pgm} -# Test 3. +# Test 3. Should print "ok" 7 times gauss_pgm=${tmpdir}/gauss.pgm -pamgauss -sigma=0.1 -tupletype=GRAYSCALE 25 25 > ${gauss_pgm} +for size in 3 4 5 8 13 21 25 +do +pamgauss -sigma=0.1 -tupletype=GRAYSCALE $size $size > ${gauss_pgm} ( for op in -null -tb -lr -r90 do pamflip $op ${gauss_pgm} | cksum @@ -58,6 +60,8 @@ pamgauss -sigma=0.1 -tupletype=GRAYSCALE 25 25 > ${gauss_pgm} awk '$1==4 && $3>0 { print "ok"; exit }; { print }' rm ${gauss_pgm} +done + # Test 4. kernel_pgm=${tmpdir}/kernel.pgm diff --git a/test/tiff-flate-lzw-roundtrip.ok b/test/tiff-flate-lzw-roundtrip.ok index 0ee3e083..4d5597cc 100644 --- a/test/tiff-flate-lzw-roundtrip.ok +++ b/test/tiff-flate-lzw-roundtrip.ok @@ -1,7 +1,7 @@ -764594701 101484 -764594701 101484 -764594701 101484 -764594701 101484 -764594701 101484 -764594701 101484 +1079668603 10237 +1079668603 10237 +1079668603 10237 +1079668603 10237 +1079668603 10237 +1079668603 10237 2425386270 41 diff --git a/test/tiff-flate-lzw-roundtrip.test b/test/tiff-flate-lzw-roundtrip.test index 7e28a899..59d4c483 100755 --- a/test/tiff-flate-lzw-roundtrip.test +++ b/test/tiff-flate-lzw-roundtrip.test @@ -1,6 +1,6 @@ #! /bin/bash # This script tests: pamtotiff tifftopnm -# Also requires: pnmquant +# Also requires: ppmpat # Failure message ## If tiff-rountrip.test succeeds and this test fails, the likely @@ -9,25 +9,26 @@ tmpdir=${tmpdir:-/tmp} -test40_ppm=${tmpdir}/testimg40.ppm +tartan_ppm=${tmpdir}/testimg40.ppm # Make a test image with reduced colors which compresses better -# cksum is 764594701 101484 - -pnmquant 40 testimg.ppm | tee ${test40_ppm} | cksum -pamtotiff ${test40_ppm} | tifftopnm | cksum +# cksum is 1079668603 10237 + +ppmpat -tartan --color=rgb:32/0d/b7,rgb:31/58/a3,rgb:e9/5e/d4 71 48 | \ + tee ${tartan_ppm} | cksum +pamtotiff ${tartan_ppm} | tifftopnm | cksum # test flate compression -pamtotiff -flate ${test40_ppm} | tifftopnm | cksum +pamtotiff -flate ${tartan_ppm} | tifftopnm | cksum # test adobeflate compression -pamtotiff -adobeflate ${test40_ppm} | tifftopnm | cksum +pamtotiff -adobeflate ${tartan_ppm} | tifftopnm | cksum # test LZW compression -pamtotiff -lzw ${test40_ppm} | tifftopnm | cksum -pamtotiff -lzw -predictor=1 ${test40_ppm} | tifftopnm | cksum +pamtotiff -lzw ${tartan_ppm} | tifftopnm | cksum +pamtotiff -lzw -predictor=1 ${tartan_ppm} | tifftopnm | cksum # PBM image: test flate compression pamtotiff -flate testgrid.pbm | tifftopnm | cksum -rm ${test40_ppm} +rm ${tartan_ppm} diff --git a/test/tiff-roundtrip.ok b/test/tiff-roundtrip.ok index f6f04103..14258de2 100644 --- a/test/tiff-roundtrip.ok +++ b/test/tiff-roundtrip.ok @@ -1,8 +1,38 @@ +PPM-rose 1926073387 101484 1926073387 101484 1926073387 101484 1926073387 101484 1926073387 101484 +PPM-6 +1646869394 29498 +1646869394 29498 +1646869394 29498 +1646869394 29498 +PPM-2 +3743909631 14836 +3743909631 14836 +3743909631 14836 +3743909631 14836 +PPM-gray +603974118 4954 +603974118 4954 +603974118 4954 +603974118 4954 +603974118 4954 +603974118 4954 +PPM-bilevel-black-white +1001018459 4954 +1001018459 4954 +1001018459 4954 +1001018459 4954 +PBM 2425386270 41 2425386270 41 2425386270 41 +Extract from multi-image TIFF +1926073387 101484 +1646869394 29498 +3743909631 14836 +603974118 4954 +1001018459 4954 diff --git a/test/tiff-roundtrip.test b/test/tiff-roundtrip.test index 747006b3..55aba278 100755 --- a/test/tiff-roundtrip.test +++ b/test/tiff-roundtrip.test @@ -1,24 +1,99 @@ #! /bin/bash # This script tests: pamtotiff tifftopnm -# Also requires: +# Also requires: ppmpat pampick ppmtopgm # Failure message ## If this test fails, the cause may be a problem in the TIFF library. +tmpdir=${tmpdir:-/tmp} +tartan_ppm=${tmpdir}/tartan.ppm +gingham_ppm=${tmpdir}/gingham.ppm +argylecolor_ppm=${tmpdir}/argyle1.ppm +argylegray_ppm=${tmpdir}/argyle2.ppm +multiimage_tiff=${tmpdir}/multiimage.ppm + # PPM image # Should print 1926073387 101484 five times -pamtotiff testimg.ppm | tifftopnm | cksum -pamtotiff -truecolor testimg.ppm | tifftopnm | cksum - +echo PPM-rose +pamtotiff testimg.ppm | tifftopnm -headerdump | cksum +pamtotiff -truecolor testimg.ppm -output ${multiimage_tiff} && \ + tifftopnm ${multiimage_tiff} -byrow | cksum pamtotiff -truecolor -packbits testimg.ppm | tifftopnm | cksum pamtotiff -truecolor -rowsperstrip=2 testimg.ppm | tifftopnm | cksum pamtotiff -truecolor -lsb2msb testimg.ppm | \ tifftopnm -respectfillorder | cksum +# PPM image with six colors +# Should print 1646869394 29498 four times + +echo PPM-6 +ppmpat -tartan -color=rgb:0/8/8,rgb:8/f/8,rgb:f/f/0 108 91 | \ + tee ${tartan_ppm} | cksum +pamtotiff -truecolor ${tartan_ppm} | tifftopnm | cksum +pamtotiff ${tartan_ppm} | tifftopnm -respectfillorder | cksum +pamtotiff ${tartan_ppm} -append -output ${multiimage_tiff} && \ + tifftopnm ${multiimage_tiff} | pampick 1 | cksum + + +# PPM image with two colors +# Should print 3743909631 14836 four times + +echo PPM-2 +ppmpat -argyle2 -color=rgb:0/0/0,rgb:f/8/f,rgb:0/0/0 61 81 | \ + tee ${argylecolor_ppm} | cksum +pamtotiff -indexbits=2 ${argylecolor_ppm} -append -output ${multiimage_tiff} && \ + tifftopnm ${multiimage_tiff} | pampick 2 | cksum +pamtotiff -indexbits=1 ${argylecolor_ppm} | tifftopnm | cksum +pamtotiff -indexbits=1 -g4 ${argylecolor_ppm} | tifftopnm | cksum + +# PPM image with six shades of gray +# pamtotiff detects the absence of colors and produces a grayscale +# tiff image unless -color is specified +# Pipeline output is PGM unless -color is specified +# Should print 603974118 4954 six times + +echo PPM-gray +ppmpat -gingham3 -color=rgb:0/0/0,rgb:ff/ff/ff,rgb:0/0/0 61 81 | \ + tee ${gingham_ppm} | ppmtopgm | cksum +pamtotiff -color ${gingham_ppm} | tifftopnm | cksum +pamtotiff -indexbits=1,2 -mb -fill ${gingham_ppm} | tifftopnm | cksum +pamtotiff -indexbits=1,2 -mw ${gingham_ppm} | tifftopnm | cksum +pamtotiff -indexbits=1,2,4,8 -mb ${gingham_ppm} | tifftopnm | cksum +pamtotiff -mb ${gingham_ppm} -append -output ${multiimage_tiff} && \ + tifftopnm ${multiimage_tiff} | pampick 3 | cksum + +# PPM image with two shades of gray (bilevel) +# pamtotiff detects the absence of colors and produces a grayscale +# tiff image unless -color is specified +# Pipeline output is PGM unless -color is specified +# Should print 1001018459 4954 four times + +echo PPM-bilevel-black-white +ppmpat -argyle2 -color=rgb:0/0/0,rgb:ff/ff/ff,rgb:0/0/0 61 81 | \ + tee ${argylegray_ppm} | ppmtopgm | cksum +pamtotiff -color -fill ${argylegray_ppm} | tifftopnm | cksum +pamtotiff -indexbits=1 -mw ${argylegray_ppm} | tifftopnm | cksum +pamtotiff -mb ${argylegray_ppm} -append -output ${multiimage_tiff} && \ + tifftopnm ${multiimage_tiff} | pampick 4 | cksum + # PBM image # Should print 2425386270 41 three times +echo PBM pamtotiff testgrid.pbm | tifftopnm | cksum pamtotiff -g3 -fill testgrid.pbm | tifftopnm | cksum -pamtotiff -g4 testgrid.pbm | tifftopnm | cksum +pamtotiff -g4 -mb testgrid.pbm -append -output ${multiimage_tiff} && \ + tifftopnm ${multiimage_tiff} | pampick 5 | cksum + +# Extract individual images from multi-image tiff file + +echo "Extract from multi-image TIFF" +tifftopnm ${multiimage_tiff} | pampick 0 | cksum +tifftopnm ${multiimage_tiff} | pampick 1 | cksum +tifftopnm ${multiimage_tiff} | pampick 2 | cksum +tifftopnm ${multiimage_tiff} | pampick 3 | cksum +tifftopnm ${multiimage_tiff} | pampick 4 | cksum + +rm ${tartan_ppm} ${gingham_ppm} ${argylecolor_ppm} \ + ${argylegray_ppm} ${multiimage_tiff} \ No newline at end of file diff --git a/test/tiffcmyk-roundtrip.ok b/test/tiffcmyk-roundtrip.ok new file mode 100644 index 00000000..e152d0a7 --- /dev/null +++ b/test/tiffcmyk-roundtrip.ok @@ -0,0 +1,5 @@ + 3 1 1 1 + 3 1 1 1 + 3 1 1 1 + 3 1 1 1 + 3 1 1 1 diff --git a/test/tiffcmyk-roundtrip.test b/test/tiffcmyk-roundtrip.test new file mode 100755 index 00000000..e123d807 --- /dev/null +++ b/test/tiffcmyk-roundtrip.test @@ -0,0 +1,46 @@ +#! /bin/bash +# This script tests: pnmtotiffcmyk tifftopnm +# Also requires: pnmpsnr + +# Failure message +## If this test fails, the cause may be a problem in the TIFF library. + +tmpdir=${tmpdir:-/tmp} +tartan_ppm=${tmpdir}/tartan.ppm +output_ppm=${tmpdir}/output.ppm +output_tiff=${tmpdir}/output.tiff + +# Note that color images cannot be tested by the roundtrip method +# because of approximations incurred by converting from RGB to CMYK + +pnmtotiffcmyk testimg.ppm > ${output_tiff} && \ + tifftopnm -headerdump -byrow ${output_tiff} | \ + pnmpsnr -machine - testimg.ppm | \ + awk '{printf("%3d %1d %1d %1d\n",NF,$1>45.0,$2>59.5,$3>56.5)}' + + +# Note that "-rowsperstrip=1" does not work +pnmtotiffcmyk -rowsperstrip 1 -lsb2msb testimg.ppm > ${output_tiff} && \ + tifftopnm -respectfillorder -byrow ${output_tiff} | \ + pnmpsnr -machine - testimg.ppm | \ + awk '{printf("%3d %1d %1d %1d\n",NF,$1>45.0,$2>59.5,$3>56.5)}' + + +pnmtotiffcmyk -packbits testimg.ppm > ${output_tiff} && \ + tifftopnm -byrow ${output_tiff} | \ + pnmpsnr -machine - testimg.ppm | \ + awk '{printf("%3d %1d %1d %1d\n",NF,$1>45.0,$2>59.5,$3>56.5)}' + + +pnmtotiffcmyk -lzw testimg.ppm > ${output_tiff} && \ + tifftopnm -byrow ${output_tiff} | \ + pnmpsnr -machine - testimg.ppm | \ + awk '{printf("%3d %1d %1d %1d\n",NF,$1>45.0,$2>59.5,$3>56.5)}' + + +pnmtotiffcmyk -lzw -predictor 2 testimg.ppm > ${output_tiff} && \ + tifftopnm -respectfillorder -byrow ${output_tiff} | \ + pnmpsnr -machine - testimg.ppm | \ + awk '{printf("%3d %1d %1d %1d\n",NF,$1>45.0,$2>59.5,$3>56.5)}' + +rm ${output_tiff} \ No newline at end of file |