diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2016-06-26 18:15:09 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2016-06-26 18:15:09 +0000 |
commit | aab4792db8e0adcaf63cf57a1f5e0b18666dae47 (patch) | |
tree | bbfa9c4e12783d2dfd785c4e10964366550e9a60 /test | |
parent | fe14f983ade44baa0794e4ce58a1a5334e46cf68 (diff) | |
download | netpbm-mirror-aab4792db8e0adcaf63cf57a1f5e0b18666dae47.tar.gz netpbm-mirror-aab4792db8e0adcaf63cf57a1f5e0b18666dae47.tar.xz netpbm-mirror-aab4792db8e0adcaf63cf57a1f5e0b18666dae47.zip |
Promote Development to Advanced as Release 10.75.00
git-svn-id: http://svn.code.sf.net/p/netpbm/code/advanced@2803 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'test')
-rw-r--r-- | test/Test-Order | 5 | ||||
-rw-r--r-- | test/all-in-place.ok | 20 | ||||
-rwxr-xr-x | test/all-in-place.test | 87 | ||||
-rw-r--r-- | test/enlarge-reduce-roundtrip.ok | 17 | ||||
-rwxr-xr-x | test/enlarge-reduce-roundtrip.test | 34 | ||||
-rw-r--r-- | test/fiasco-roundtrip.ok | 1 | ||||
-rwxr-xr-x | test/fiasco-roundtrip.test | 8 | ||||
-rw-r--r-- | test/legacy-names.ok | 14 | ||||
-rwxr-xr-x | test/legacy-names.test | 52 | ||||
-rw-r--r-- | test/pbmtext.ok | 11 | ||||
-rwxr-xr-x | test/pbmtext.test | 125 | ||||
-rw-r--r-- | test/pnmquantall.ok | 5 | ||||
-rwxr-xr-x | test/pnmquantall.test | 17 | ||||
-rwxr-xr-x | test/ppmchange.test | 2 |
14 files changed, 275 insertions, 123 deletions
diff --git a/test/Test-Order b/test/Test-Order index 92efca05..38873bd4 100644 --- a/test/Test-Order +++ b/test/Test-Order @@ -62,6 +62,7 @@ pambackground.test pbmpscale.test pnmremap1.test pnmremap2.test +pnmquantall.test pnmtile.test ppmbrighten.test ppmdither.test @@ -103,6 +104,7 @@ ppmchange-roundtrip.test pamdice-roundtrip.test pamslice-roundtrip.test lookup-roundtrip.test +enlarge-reduce-roundtrip.test # Round-trip tests : lossless converters @@ -150,6 +152,7 @@ xpm-roundtrip.test xv-roundtrip.test xwd-roundtrip.test -# Round-trip tests : lossy converter +# Round-trip tests : lossy converters +fiasco-roundtrip.test yuv-roundtrip.test diff --git a/test/all-in-place.ok b/test/all-in-place.ok index 6ba75993..2fe1ed52 100644 --- a/test/all-in-place.ok +++ b/test/all-in-place.ok @@ -11,6 +11,7 @@ cmuwmtopbm: ok ddbugtopbm: ok escp2topbm: ok eyuvtoppm: ok +fiascotopnm: ok fitstopnm: ok fstopgm: ok g3topbm: ok @@ -78,6 +79,7 @@ pamsplit: ok pamstack: ok pamstereogram: ok pamstretch: ok +pamstretch-gen: ok pamsumm: ok pamsummcol: ok pamthreshold: ok @@ -195,6 +197,7 @@ pnmhisteq: ok pnmhistmap: ok pnmindex: ok pnminvert: ok +pnmmargin: ok pnmmercator: ok pnmmontage: ok pnmnlfilt: ok @@ -202,6 +205,8 @@ pnmnorm: ok pnmpad: ok pnmpaste: ok pnmpsnr: ok +pnmquant: ok +pnmquantall: ok pnmremap: ok pnmrotate: ok pnmscalefixed: ok @@ -236,6 +241,7 @@ ppmdist: ok ppmdither: ok ppmdmkfont: ok ppmdraw: ok +ppmfade: ok ppmflash: ok ppmforge: ok ppmglobe: ok @@ -245,8 +251,10 @@ ppmmake: ok ppmmix: ok ppmntsc: ok ppmpat: ok +ppmrainbow: ok ppmrelief: ok ppmrough: ok +ppmshadow: ok ppmshift: ok ppmspread: ok ppmtoacad: ok @@ -315,15 +323,5 @@ yuvsplittoppm: ok yuvtoppm: ok yuy2topam: ok zeisstopnm: ok -fiascotopnm: ok -manweb: ok -pnmmargin: ok anytopnm: ok -ppmtomap: ok -ppmshadow: ok -pnmquant: ok -pnmquantall: ok -ppmrainbow: ok -ppmfade: ok -pamstretch-gen: ok -pcdovtoppm: ok +manweb: ok diff --git a/test/all-in-place.test b/test/all-in-place.test index 4c8af56b..e372d373 100755 --- a/test/all-in-place.test +++ b/test/all-in-place.test @@ -4,9 +4,12 @@ # We test by actually running all the executables. # Failure message -# See Netpbm Library Prerequisites -# http://netpbm.sourceforge.net/prereq.html -# if make succeeds but this test fails. +## See Netpbm Library Prerequisites +## http://netpbm.sourceforge.net/prereq.html +## if make succeeds but this test fails +## +## If you run the "make test-install" on an older version, some executables +## may be reported as missing because of missing features. function testExitStatus () { @@ -50,6 +53,7 @@ ordinary_testprogs="\ ddbugtopbm \ escp2topbm \ eyuvtoppm \ + fiascotopnm \ fitstopnm \ fstopgm \ g3topbm \ @@ -117,6 +121,7 @@ ordinary_testprogs="\ pamstack \ pamstereogram \ pamstretch \ + pamstretch-gen \ pamsumm \ pamsummcol \ pamthreshold \ @@ -234,6 +239,7 @@ ordinary_testprogs="\ pnmhistmap \ pnmindex \ pnminvert \ + pnmmargin \ pnmmercator \ pnmmontage \ pnmnlfilt \ @@ -241,6 +247,8 @@ ordinary_testprogs="\ pnmpad \ pnmpaste \ pnmpsnr \ + pnmquant \ + pnmquantall \ pnmremap \ pnmrotate \ pnmscalefixed \ @@ -275,6 +283,7 @@ ordinary_testprogs="\ ppmdither \ ppmdmkfont \ ppmdraw \ + ppmfade \ ppmflash \ ppmforge \ ppmglobe \ @@ -284,8 +293,10 @@ ordinary_testprogs="\ ppmmix \ ppmntsc \ ppmpat \ + ppmrainbow \ ppmrelief \ ppmrough \ + ppmshadow \ ppmshift \ ppmspread \ ppmtoacad \ @@ -356,74 +367,28 @@ ordinary_testprogs="\ zeisstopnm \ " +# The string "fiascotopnm" has to be filtered out by egrep for fiascotopnm +# has a slightly different version report format. + for i in $ordinary_testprogs do $i --version 2>&1 | \ - egrep -v \ + egrep -v -e fiascotopnm -e \ "(Using libnetpbm|Compiled|(BSD|SYSV|MSDOS|AMIGA) defined|RGB_?ENV=)" \ 1>&2; testExitStatus $i 0 ${PIPESTATUS[0]} done -# Test fiascotopnm, which has a unique -v flag. -fiascotopnm -v 2> /dev/null - testExitStatus fiascotopnm 2 $? - - -# Test manweb and pnmmargin, which have --help. -manweb --help > /dev/null - testExitStatus manweb 0 $? - -pnmmargin --help 2> /dev/null - testExitStatus pnmmargin 1 $? - - -# Test anytopnm, pnmnoraw, pnmquant, pnmquantall -# ppmrainbow, ppmshadow, ppmtomap -# with trivial input. - -$i ${tmpdir}/test.pbm > /dev/null 2> /dev/null; -tmpdir=${tmpdir:-/tmp} -test_pbm=${tmpdir}/test.pbm - -cat > ${test_pbm} <<EOF -P1 -1 1 -1 -EOF - -for i in anytopnm ppmtomap ppmshadow - do - $i ${tmpdir}/test.pbm > /dev/null 2> /dev/null; - testExitStatus $i 0 $? - done - -for i in pnmquant pnmquantall - do - $i 2 ${tmpdir}/test.pbm > /dev/null 2> /dev/null; - testExitStatus $i 0 $? - done - -rm ${test_pbm} - ppmrainbow rgb:00/00/00 rgb:ff/ff/ff \ - -tmpdir=${tmpdir} -width=2 -height=2 > /dev/null - testExitStatus ppmrainbow 0 $? +# Anytopnm now supports --version but it delegates the report to pamtopnm. +# It fails if pamtopnm is absent. +# We consider anytopnm too important to test in an indirect manner. +anytopnm testgrid.pbm > /dev/null 2> /dev/null; +testExitStatus anytopnm 0 $? -# Test ppmfade with corrupt input. -# Prevent the creation of output files by setting base to /dev/null. -# Exit status should be 50. - ppmfade -f /dev/zero -base /dev/null > /dev/null 2> /dev/null - testExitStatus ppmfade 50 $? +# Test manweb which has --help. -# Test pamstretch-gen and pcdovtoppm with no input. -# These two programs write a usage message on standout in this case. -# Exit status should be 1. - -for i in pamstretch-gen pcdovtoppm - do - $i > /dev/null - testExitStatus $i 1 $? - done +manweb --help > /dev/null + testExitStatus manweb 0 $? diff --git a/test/enlarge-reduce-roundtrip.ok b/test/enlarge-reduce-roundtrip.ok new file mode 100644 index 00000000..8ee8118a --- /dev/null +++ b/test/enlarge-reduce-roundtrip.ok @@ -0,0 +1,17 @@ +2364818683 590 +2364818683 590 +2364818683 590 +2364818683 590 +2364818683 590 +2364818683 590 +2364818683 590 +2364818683 590 +2364818683 590 +2364818683 590 +2364818683 590 +2364818683 590 +2364818683 590 +2364818683 590 +2364818683 590 +2364818683 590 +2364818683 590 diff --git a/test/enlarge-reduce-roundtrip.test b/test/enlarge-reduce-roundtrip.test new file mode 100755 index 00000000..54b52c60 --- /dev/null +++ b/test/enlarge-reduce-roundtrip.test @@ -0,0 +1,34 @@ +#! /bin/bash +# This script tests: pamenlarge pbmpscale pbmreduce +# Also requires: pbmtext + +tmpdir=${tmpdir:-/tmp} +xanadu_pbm=${tmpdir}/xanadu.pbm + +echo "In Xanadu did Kubla khan" | pbmtext > ${xanadu_pbm} + +# Should print 2364818683 590 + +cat ${xanadu_pbm} | cksum + +# Should print 2364818683 590 eight times + +for scale in 2 4 6 7 + do + for flag in "-fs -randomseed=0" "-threshold -v 0.4" + do + pamenlarge ${scale} ${xanadu_pbm} | pbmreduce ${flag} ${scale} | cksum + done + done + +# Should print 2364818683 590 eight times + +for scale in 5 7 9 11 + do + for flag in "-fs -randomseed=0" "-threshold" + do + pbmpscale ${scale} ${xanadu_pbm} | pbmreduce ${flag} ${scale} | cksum + done + done + +rm ${xanadu_pbm} diff --git a/test/fiasco-roundtrip.ok b/test/fiasco-roundtrip.ok new file mode 100644 index 00000000..e26677f4 --- /dev/null +++ b/test/fiasco-roundtrip.ok @@ -0,0 +1 @@ +215556145 102615 diff --git a/test/fiasco-roundtrip.test b/test/fiasco-roundtrip.test new file mode 100755 index 00000000..f733c04a --- /dev/null +++ b/test/fiasco-roundtrip.test @@ -0,0 +1,8 @@ +#! /bin/bash +# This script tests: pnmtofiasco fiascotopnm +# Also requires: pnmpad + +# Should print 215556145 102615 + +pnmpad --black --bottom 1 --left 1 testimg.ppm | \ + pnmtofiasco --progress-meter 0 | fiascotopnm | cksum diff --git a/test/legacy-names.ok b/test/legacy-names.ok index 9676639b..94ef875f 100644 --- a/test/legacy-names.ok +++ b/test/legacy-names.ok @@ -4,6 +4,8 @@ icontopbm: ok pamfixtrunc: ok pamrgbatopng: ok pbmtoicon: ok +pbmtox10bm: ok +pgmcrater: ok pgmedge: ok pgmnorm: ok pgmoil: ok @@ -17,21 +19,21 @@ pnmenlarge: ok pnmfile: ok pnmflip: ok pnminterp: ok +pnmnoraw: ok pnmscale: ok pnmsplit: ok pnmtofits: ok +pnmtoplainpnm: ok pnmtopnm: ok pnmtotiff: ok ppmnorm: ok +ppmquant: ok +ppmquantall: ok ppmtogif: ok ppmtojpeg: ok +ppmtomap: ok ppmtompeg: ok ppmtotga: ok ppmtouil: ok -pgmcrater: ok -pbmtox10bm: ok -pnmnoraw: ok -pnmtoplainpnm: ok -ppmquant: ok -ppmquantall: ok hpcdtoppm: ok +pcdovtoppm: ok diff --git a/test/legacy-names.test b/test/legacy-names.test index df40e62d..30509d20 100755 --- a/test/legacy-names.test +++ b/test/legacy-names.test @@ -10,6 +10,12 @@ ## ## Important: This test checks obsoleted names. ## Programs here do not appear in other tests. +## +## Programs here are wrapper scripts provided for backward compatibility. +## The newer replacement program may be the cause of any failure reported. +## +## If you run the "make test-install" on an older version, some executables +## may be reported as missing because of missing features. # Skip this test if CHECK_TYPE = tree @@ -55,6 +61,8 @@ ordinary_testprogs="\ pamfixtrunc \ pamrgbatopng \ pbmtoicon \ + pbmtox10bm \ + pgmcrater \ pgmedge \ pgmnorm \ pgmoil \ @@ -68,14 +76,19 @@ ordinary_testprogs="\ pnmfile \ pnmflip \ pnminterp \ + pnmnoraw \ pnmscale \ pnmsplit \ pnmtofits \ + pnmtoplainpnm \ pnmtopnm \ pnmtotiff \ ppmnorm \ + ppmquant \ + ppmquantall \ ppmtogif \ ppmtojpeg \ + ppmtomap \ ppmtompeg \ ppmtotga \ ppmtouil \ @@ -91,42 +104,11 @@ for i in $ordinary_testprogs done -# Test pgmcrater - -pgmcrater -number 1 -xsize 15 -ysize 15 -randomseed 1 > /dev/null -testExitStatus pgmcrater 0 $? - - -# Test pbmtox10bm, pnmnoraw, pnmtoplainpnm, ppmquantall, ppmrainbow -# with trivial input. -$i ${tmpdir}/test.pbm > /dev/null 2> /dev/null; -tmpdir=${tmpdir:-/tmp} -test_pbm=${tmpdir}/test.pbm - -cat > ${test_pbm} <<EOF -P1 -1 1 -1 -EOF - -for i in pbmtox10bm pnmnoraw pnmtoplainpnm - do - $i ${tmpdir}/test.pbm > /dev/null 2> /dev/null; - testExitStatus $i 0 $? - done - -for i in ppmquant ppmquantall - do - $i 2 ${tmpdir}/test.pbm > /dev/null 2> /dev/null; - testExitStatus $i 0 $? - done - - -rm ${test_pbm} - - -# Test hpcdtoppm. Simply confirm its existence. +# Test hpcdtoppm and pcdovtoppm. Simply confirm their existence. type -p hpcdtoppm > /dev/null testExitStatus hpcdtoppm 0 $? + +type -p pcdovtoppm > /dev/null +testExitStatus pcdovtoppm 0 $? diff --git a/test/pbmtext.ok b/test/pbmtext.ok index f19df9aa..bd12fb94 100644 --- a/test/pbmtext.ok +++ b/test/pbmtext.ok @@ -11,3 +11,14 @@ 1305436978 1018 1647614653 2027 1647614653 2027 +1647614653 2027 +3233136020 4535 +1216262214 5711 +386826492 35 +1 +1 +1 +1 +1 +1 +1 diff --git a/test/pbmtext.test b/test/pbmtext.test index 0a177270..20c9b285 100755 --- a/test/pbmtext.test +++ b/test/pbmtext.test @@ -19,9 +19,9 @@ text="The quick brown fog jumps over the lazy docs." # Test 2: -for flags in "" "-nom" "-builtin fixed" +for flags in "" "-nomargins" "-builtin fixed" do -echo $text | pbmtext $flags | cksum +echo ${text} | pbmtext ${flags} | cksum done temp_pbm=${tmpdir}/temp.pbm @@ -33,13 +33,19 @@ temp_pbm=${tmpdir}/temp.pbm for flags in "" "-builtin fixed" do pbmtext ${flags} ${text} | tee ${temp_pbm} | cksum -width=`pamfile ${temp_pbm} | awk '$2=="PBM" && NR==1 { w=$4}; END {print w}' ` -pbmtext ${flags} -width=$width $text | cksum +width1=`pamfile ${temp_pbm} | awk '$2=="PBM" && NR==1 {w=$4}; END {print w}' ` +width2=`pbmtext ${flags} ${text} --dry-run | awk '{print $1}' ` + +if [ ${width1} -eq ${width2} ]; then + pbmtext ${flags} -width=${width1} ${text} | cksum +else + echo ${width1} ${width2} +fi rm ${temp_pbm} done -# Test 3: Should print 1647614653 2027 twice +# Test 4: Should print 1647614653 2027 three times # Note: backslashes inserted in 3 locations in the rectange to make # possible input as a here document. @@ -61,8 +67,111 @@ _ PQRSTUVWXYZ[ _ M ",/^_[\`jpqy| M EOF -cat ${fontRectangle_txt} | pbmtext -nom -builtin fixed | tee ${font_pbm} | \ -cksum +pbmtext -dump-sheet -builtin fixed | tee ${font_pbm} | cksum +cat ${fontRectangle_txt} | pbmtext -nom -builtin fixed | cksum cat ${fontRectangle_txt} | pbmtext -nom -font ${font_pbm} | cksum - rm ${fontRectangle_txt} ${font_pbm} + + +# Test 5: Print all characters defined in the built-in bdf font + +# One long row +# Should print +awk 'BEGIN { for (i=32; i<=125;++i) printf("%c",i); + for (i=160;i<=255;++i) printf("%c",i); }' | \ + pbmtext -builtin bdf | cksum + +# One tall column +# Should print +awk 'BEGIN { for (i=32; i<=125;++i) printf("%c\n",i); + for (i=160;i<=255;++i) printf("%c\n",i); }' | \ + pbmtext -nomargins -builtin bdf | cksum + + +# Test 6: +# Test corruptions in BDF font file. + +font_bdf=${tmpdir}/font.bdf +font_corrupt_bdf=${tmpdir}/fontcorrupt.bdf + +# Though this is BDF font file defines only three letters, it is valid. + +cat > ${font_bdf} << EOF +STARTFONT 2.1 +COMMENT $XFree86: xc/fonts/bdf/misc/micro.bdf,v 1.1 1999/09/25 14:36:34 dawes Exp $ - Modified for test +FONT micro +SIZE 4 75 75 +FONTBOUNDINGBOX 4 5 0 0 +STARTPROPERTIES 3 +FONT_DESCENT 0 +FONT_ASCENT 5 +CHARSET_REGISTRY "ISO88591" +CHARSET_ENCODING "1" +COPYRIGHT "Public domain font. Share and enjoy." +ENDPROPERTIES +CHARS 3 +STARTCHAR A +ENCODING 65 +SWIDTH 1000 0 +DWIDTH 4 0 +BBX 4 5 0 0 +BITMAP +e0 +a0 +e0 +a0 +a0 +ENDCHAR +STARTCHAR B +ENCODING 66 +SWIDTH 1000 0 +DWIDTH 4 0 +BBX 4 5 0 0 +BITMAP +e0 +a0 +c0 +a0 +e0 +ENDCHAR +STARTCHAR C +ENCODING 67 +SWIDTH 1000 0 +DWIDTH 4 0 +BBX 4 5 0 0 +BITMAP +e0 +80 +80 +80 +e0 +ENDCHAR +ENDFONT +EOF + +# This should succeed and produce 386826492 35 +pbmtext -font ${font_bdf} ABC | cksum + +# The rest should all fail. Writes 1 seven times. +pbmtext -font ${font_bdf} BCD +echo $? + +sed 's/FONTBOUNDINGBOX 4 5 0 0/FONTBOUNDINGBOX 4 4 0 0/' \ + ${font_bdf} > ${font_corrupt_bdf} +pbmtext -font ${font_corrupt_bdf} ABC > /dev/null +echo $? +rm ${font_corrupt_bdf} + +sed 's/BBX 4 5 0 0/BBX 4 6 0 0/' \ + ${font_bdf} > ${font_corrupt_bdf} +pbmtext -font ${font_corrupt_bdf} ABC > /dev/null +echo $? +rm ${font_corrupt_bdf} + +for delete_line in 14 16 18 20 + do + sed "${delete_line}"d ${font_bdf} > ${font_corrupt_bdf} + pbmtext -font ${font_corrupt_bdf} ABC > /dev/null + echo $? + rm ${font_corrupt_bdf} + done diff --git a/test/pnmquantall.ok b/test/pnmquantall.ok new file mode 100644 index 00000000..bd5bbc05 --- /dev/null +++ b/test/pnmquantall.ok @@ -0,0 +1,5 @@ +got color map +2373957371 33838 testimg.red +3892560659 33838 testimg.grn +1383839923 33838 testimg.blu +1 diff --git a/test/pnmquantall.test b/test/pnmquantall.test new file mode 100755 index 00000000..f0f18ab0 --- /dev/null +++ b/test/pnmquantall.test @@ -0,0 +1,17 @@ +#! /bin/bash +# This script tests: pnmquantall +# Also requires: ppmtorgb3 pgmhist + +ppmtorgb3 testimg.ppm + +pnmquantall 20 testimg.red testimg.grn testimg.blu + +for i in testimg.red testimg.grn testimg.blu +do +cksum $i +done + +# Should print 1 + +pnmcat testimg.red testimg.grn testimg.blu -tb | \ + pgmhist -m | awk '$2>0 {s++}; END { print s<=20 }' diff --git a/test/ppmchange.test b/test/ppmchange.test index d29a699f..397b290f 100755 --- a/test/ppmchange.test +++ b/test/ppmchange.test @@ -5,7 +5,7 @@ # Failure message ## If this test fails and ppmchange-roundtrip.test succeeds, -## the probably cause is a problem with one of the options of +## the probable cause is a problem with one of the options of ## ppmchange: -closeness or -remainder. tmpdir=${tmpdir:-/tmp} |