diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2017-02-09 02:33:16 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2017-02-09 02:33:16 +0000 |
commit | 233fc3732e9f5e5f8e4987f23adac923b62a5798 (patch) | |
tree | 0232e04ea5af306775525fef3a9a44ce3deaf873 | |
parent | 4d8afd9f91b028c5d23ee7229ae8687c67a6fb3d (diff) | |
download | netpbm-mirror-233fc3732e9f5e5f8e4987f23adac923b62a5798.tar.gz netpbm-mirror-233fc3732e9f5e5f8e4987f23adac923b62a5798.tar.xz netpbm-mirror-233fc3732e9f5e5f8e4987f23adac923b62a5798.zip |
Various new tests and other test improvements from afu
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@2888 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rwxr-xr-x | test/Available-Testprog | 27 | ||||
-rw-r--r-- | test/Test-Order | 4 | ||||
-rw-r--r-- | test/fiasco-roundtrip.ok | 2 | ||||
-rwxr-xr-x | test/fiasco-roundtrip.test | 20 | ||||
-rw-r--r-- | test/jpeg-roundtrip.ok | 3 | ||||
-rwxr-xr-x | test/jpeg-roundtrip.test | 21 | ||||
-rw-r--r-- | test/jpeg2k-roundtrip.ok | 1 | ||||
-rwxr-xr-x | test/jpeg2k-roundtrip.test | 7 | ||||
-rw-r--r-- | test/ps-flate-roundtrip.ok | 3 | ||||
-rwxr-xr-x | test/ps-flate-roundtrip.test | 48 | ||||
-rw-r--r-- | test/ps-roundtrip.ok | 1 | ||||
-rwxr-xr-x | test/ps-roundtrip.test | 14 | ||||
-rw-r--r-- | test/tiff-flate-lzw-roundtrip.ok | 5 | ||||
-rwxr-xr-x | test/tiff-flate-lzw-roundtrip.test | 40 | ||||
-rwxr-xr-x | test/tiff-roundtrip.test | 7 |
15 files changed, 180 insertions, 23 deletions
diff --git a/test/Available-Testprog b/test/Available-Testprog index 67df13c1..8176b57a 100755 --- a/test/Available-Testprog +++ b/test/Available-Testprog @@ -15,6 +15,10 @@ fi # Normal operation: Walk through the argument list and exit if an # unavailable program is encountered. +# See http://netpbm.sourceforge.net/prereq.html and the makefiles in +# each directory (for example converter/other/Makefile) for library +# requirements and relevant variables. + for i in $@ do case $i in @@ -39,14 +43,33 @@ for i in $@ pnmtotiff|\ pnmtotiffcmyk|\ tifftopnm) - [ "${TIFFLIB}" = "NONE" ] && exit 1 ;; + [ "${TIFFLIB}" = "NONE" -o \ + "${JPEGLIB}" = "NONE" -o \ + "${ZLIB}" = "NONE" ] && exit 1 ;; pnmtorle|\ rletopnm) [ "${URTLIB}" = "NONE" ] && exit 1 ;; + pamx) + [ "${X11LIB}" = "NONE" ] && exit 1 ;; + + svgtopam) + [ "${XML2_LIBS}" = "NONE" ] && exit 1 ;; + + thinkjettopbm) + [ -z "${LEX}" ] && exit 1 ;; + + zlib) + [ "${ZLIB}" = "NONE" ] && exit 1 ;; + esac done # All checks passed. Exit with success status. -exit 0 \ No newline at end of file +exit 0 + + +# TODO: We don't have a good method for testing whether PNGLIB is +# available for linking. +# Affected programs: pamtopng, pngtopam, pngtopnm, pnmtopng diff --git a/test/Test-Order b/test/Test-Order index 38873bd4..8c5a7aae 100644 --- a/test/Test-Order +++ b/test/Test-Order @@ -124,6 +124,7 @@ gif-quant-roundtrip.test hdiff-roundtrip.test ilbm-roundtrip.test jbig-roundtrip.test +jpeg2k-roundtrip.test leaf-roundtrip.test macp-roundtrip.test mda-roundtrip.test @@ -136,6 +137,7 @@ pict-roundtrip.test png-roundtrip.test png-roundtrip2.test ps-roundtrip.test +ps-flate-roundtrip.test ps-alt-roundtrip.test sgi-roundtrip.test sbig-roundtrip.test @@ -144,6 +146,7 @@ sunicon-roundtrip.test sunrast-roundtrip.test targa-roundtrip.test tiff-roundtrip.test +tiff-flate-lzw-roundtrip.test utahrle-roundtrip.test wbmp-roundtrip.test winicon-roundtrip.test @@ -155,4 +158,5 @@ xwd-roundtrip.test # Round-trip tests : lossy converters fiasco-roundtrip.test +jpeg-roundtrip.test yuv-roundtrip.test diff --git a/test/fiasco-roundtrip.ok b/test/fiasco-roundtrip.ok index e26677f4..8a5e8ff6 100644 --- a/test/fiasco-roundtrip.ok +++ b/test/fiasco-roundtrip.ok @@ -1 +1 @@ -215556145 102615 + 3 1 1 1 \ No newline at end of file diff --git a/test/fiasco-roundtrip.test b/test/fiasco-roundtrip.test index f733c04a..6fd43432 100755 --- a/test/fiasco-roundtrip.test +++ b/test/fiasco-roundtrip.test @@ -1,8 +1,20 @@ #! /bin/bash # This script tests: pnmtofiasco fiascotopnm -# Also requires: pnmpad +# Also requires: pnmpad pnmpsnr -# Should print 215556145 102615 +# Pnmtofiasco: number of rows, cols in input file must be even +# Pnmpsnr output: 15.11 22.71 30.09 +# TODO: As in jpeg-rountrip.test the threshold has been determined +# without much thought. -pnmpad --black --bottom 1 --left 1 testimg.ppm | \ - pnmtofiasco --progress-meter 0 | fiascotopnm | cksum +# Should print 3 1 1 1 + +tmpdir=${tmpdir:-/tmp} +padded_ppm=${tmpdir}/padded.ppm + +pnmpad --black --bottom 1 --left 1 testimg.ppm > ${padded_ppm} && +pnmtofiasco --progress-meter 0 ${padded_ppm} | fiascotopnm | \ + pnmpsnr -machine - ${padded_ppm} | \ + awk '{printf("%3d %1d %1d %1d",NF,$1>14.0,$2>21.0,$3>$29.0)}' + +rm ${padded_ppm} \ No newline at end of file diff --git a/test/jpeg-roundtrip.ok b/test/jpeg-roundtrip.ok new file mode 100644 index 00000000..f32c58a2 --- /dev/null +++ b/test/jpeg-roundtrip.ok @@ -0,0 +1,3 @@ + 3 1 1 1 + 3 1 1 1 + 3 1 1 1 diff --git a/test/jpeg-roundtrip.test b/test/jpeg-roundtrip.test new file mode 100755 index 00000000..1afc5423 --- /dev/null +++ b/test/jpeg-roundtrip.test @@ -0,0 +1,21 @@ +#! /bin/bash +# This script tests: pnmtojpeg jpegtopnm +# Also requires: pnmpsnr + +# TODO: threshold has been determined without much thought. +# Observed pnmpsnr output: 56.20 58.26 49.38 +# A small margin has been added to the above numbers. + +# Should print 3 1 1 1 three times + +pnmtojpeg testimg.ppm | jpegtopnm | \ + pnmpsnr -machine - testimg.ppm |\ + awk '{printf("%3d %1d %1d %1d\n",NF,$1>55.0,$2>57.0,$3>48.0)}' + +pnmtojpeg testimg.ppm -opt | jpegtopnm | \ + pnmpsnr -machine - testimg.ppm |\ + awk '{printf("%3d %1d %1d %1d\n",NF,$1>55.0,$2>57.0,$3>48.0)}' + +pnmtojpeg testimg.ppm -progressive | jpegtopnm | \ + pnmpsnr -machine - testimg.ppm |\ + awk '{printf("%3d %1d %1d %1d\n",NF,$1>55.0,$2>57.0,$3>48.0)}' \ No newline at end of file diff --git a/test/jpeg2k-roundtrip.ok b/test/jpeg2k-roundtrip.ok new file mode 100644 index 00000000..82eac5a8 --- /dev/null +++ b/test/jpeg2k-roundtrip.ok @@ -0,0 +1 @@ +1926073387 101484 diff --git a/test/jpeg2k-roundtrip.test b/test/jpeg2k-roundtrip.test new file mode 100755 index 00000000..eab6fb1e --- /dev/null +++ b/test/jpeg2k-roundtrip.test @@ -0,0 +1,7 @@ +#! /bin/bash +# This script tests: pamtojpeg2k jpeg2ktopam +# Also requires: pnmpsnr + +# Should produce 1926073387 101484 + +pamtojpeg2k testimg.ppm | jpeg2ktopam | cksum \ No newline at end of file diff --git a/test/ps-flate-roundtrip.ok b/test/ps-flate-roundtrip.ok new file mode 100644 index 00000000..57fb124f --- /dev/null +++ b/test/ps-flate-roundtrip.ok @@ -0,0 +1,3 @@ +1926073387 101484 +1926073387 101484 +1386192571 507420 diff --git a/test/ps-flate-roundtrip.test b/test/ps-flate-roundtrip.test new file mode 100755 index 00000000..de1105f0 --- /dev/null +++ b/test/ps-flate-roundtrip.test @@ -0,0 +1,48 @@ +#! /bin/bash +# This script tests: pnmtops pstopnm +# Also requires: pamtopnm gs zlib + +# This script tests the optional flate (zlib) compression feature of +# pstopnm. +# Flate compression allows you to make smaller output (.ps) files: +# it is useful, but not essential. Flate compression is not neccessary for +# printing pages with postscript printers - which is why many people need +# pnmtops on their systems. + +# Failure message +## This test fails when ghostscript is not available. + +tmpdir=${tmpdir:-/tmp} + +# pstopnm does not use libnetpbm functions for output. +# Output is filtered through pamtopnm. + +# Test 1. Should print: 1926073387 101484 twice +test1_ps=${tmpdir}/testimg1.ps + +for flag in "-ps -flate" "-ps -rle -ascii -flate" + do + pnmtops -nocenter -equalpixels -dpi 72 -noturn ${flag} testimg.ppm \ + > ${test1_ps} && \ + xysize1=`awk '/BoundingBox/ {print "-xsize="$4,"-ysize="$5}' \ + ${test1_ps}` && \ + pstopnm -portrait -xborder=0 -yborder=0 $xysize1 -stdout -quiet \ + ${test1_ps} | pamtopnm | cksum + done + +rm ${test1_ps} + +# Test 2. Should print: 1386192571 507420 +# See comments in ps-roundtrip.test + +test3_ps=${tmpdir}/testimg3.ps +flag="-ps -bitspersample=12 -flate -rle -vmreclaim" +cat testimg.ppm testimg.ppm testimg.ppm testgrid.pbm testgrid.pbm | \ +pnmtops -nocenter -equalpixels -dpi 72 -noturn -setpage ${flag} \ + > ${test3_ps} && +xysize3=`awk '/BoundingBox/ {print "-xsize="$4,"-ysize="$5 ; exit}' \ + ${test3_ps}` && +pstopnm -portrait -xborder=0 -yborder=0 $xysize3 -stdout ${test3_ps} | \ + pamtopnm | cksum + +rm ${test3_ps} diff --git a/test/ps-roundtrip.ok b/test/ps-roundtrip.ok index 0ebfb94a..5ef66cc4 100644 --- a/test/ps-roundtrip.ok +++ b/test/ps-roundtrip.ok @@ -2,7 +2,6 @@ 1926073387 101484 1926073387 101484 1926073387 101484 -1926073387 101484 2918318199 62 2918318199 62 2918318199 62 diff --git a/test/ps-roundtrip.test b/test/ps-roundtrip.test index 873bbdef..207646cc 100755 --- a/test/ps-roundtrip.test +++ b/test/ps-roundtrip.test @@ -4,21 +4,17 @@ # Failure message -## This test fails when: -## (1) zlib was not linked. -## (2) ghostscript is not available. +## This test fails when ghostscript is not available. tmpdir=${tmpdir:-/tmp} # pstopnm does not use libnetpbm functions for output. # Output is filtered through pamtopnm. -# Test 1. Should print: 1926073387 101484 five times -# *NOTE* Fifth iteration fails if pnmtops was compiled without zlib -# (flate compression) support. +# Test 1. Should print: 1926073387 101484 four times test1_ps=${tmpdir}/testimg1.ps -for flag in "" "-ps" "-rle" "-ps -ascii" "-ps -flate" +for flag in "" "-ps" "-rle" "-ps -ascii" do pnmtops -nocenter -equalpixels -dpi 72 -noturn ${flag} testimg.ppm \ > ${test1_ps} && \ @@ -57,8 +53,6 @@ for flag in "" "-rle" "-ps -rle -ascii" \ rm ${grid_ps} ${g_pbm} ${t_pbm} #Test 3. Should print: 1386192571 507420 three times -# *NOTE* Second iteration fails if pnmtops was compiled without zlib -# (flate compression) support. # # Special care is needed when conducting round-trips with multiple-image # files as input. @@ -72,7 +66,7 @@ rm ${grid_ps} ${g_pbm} ${t_pbm} test3_ps=${tmpdir}/testimg3.ps for flag in "" "-ps" \ - "-ps -bitspersample=12 -flate -rle -vmreclaim" + "-ps -bitspersample=12 -rle -vmreclaim" do cat testimg.ppm testimg.ppm testimg.ppm testgrid.pbm testgrid.pbm | \ pnmtops -nocenter -equalpixels -dpi 72 -noturn -setpage ${flag} \ diff --git a/test/tiff-flate-lzw-roundtrip.ok b/test/tiff-flate-lzw-roundtrip.ok new file mode 100644 index 00000000..2ded49dc --- /dev/null +++ b/test/tiff-flate-lzw-roundtrip.ok @@ -0,0 +1,5 @@ +764594701 101484 +764594701 101484 +764594701 101484 +764594701 101484 +2425386270 41 diff --git a/test/tiff-flate-lzw-roundtrip.test b/test/tiff-flate-lzw-roundtrip.test new file mode 100755 index 00000000..dda5b9f9 --- /dev/null +++ b/test/tiff-flate-lzw-roundtrip.test @@ -0,0 +1,40 @@ +#! /bin/bash +# This script tests: pamtotiff tifftopnm +# Also requires: pnmquant + +# Failure message +## If tiff-rountrip.test succeeds and this test fails, the likely +## cause is an old TIFF library which lacks certain compression +## features. + +tmpdir=${tmpdir:-/tmp} + +test40_ppm=${tmpdir}/testimg.ppm +test1_tiff=${tmpdir}/test1.tiff +test2_tiff=${tmpdir}/test2.tiff +test3_tiff=${tmpdir}/test3.tiff +test4_tiff=${tmpdir}/test4.tiff + +# Make a test image with reduced colors which compresses better +# cksum is 764594701 101484 + +pnmquant 40 testimg.ppm | tee ${test40_ppm} | cksum + +# test flate compression +pamtotiff -flate ${test40_ppm} 1<>${test1_tiff} && + tifftopnm ${test1_tiff} | cksum + +# test adobeflate compression +pamtotiff -adobeflate ${test40_ppm} 1<>${test2_tiff} && + tifftopnm ${test2_tiff} | cksum + +# test LZW compression +pamtotiff -lzw ${test40_ppm} 1<>${test3_tiff} && + tifftopnm ${test3_tiff} | cksum + +# PBM image: test flate compression +pamtotiff -flate testgrid.pbm 1<>${test4_tiff} && + tifftopnm ${test4_tiff} | cksum + +rm ${test40_ppm} ${test1_tiff} ${test2_tiff} ${test3_tiff} ${test4_tiff} + diff --git a/test/tiff-roundtrip.test b/test/tiff-roundtrip.test index 624337f1..df258eb1 100755 --- a/test/tiff-roundtrip.test +++ b/test/tiff-roundtrip.test @@ -2,14 +2,11 @@ # This script tests: pamtotiff tifftopnm # Also requires: -# Failure message -## Second test fails if Netpbm was built without the flate library - pamtotiff testimg.ppm 1<>${tmpdir}/test1.tiff && tifftopnm ${tmpdir}/test1.tiff | cksum -# test flate compression -pamtotiff -flate testimg.ppm 1<>${tmpdir}/test2.tiff && +# test packbits compression +pamtotiff -packbits testimg.ppm 1<>${tmpdir}/test2.tiff && tifftopnm ${tmpdir}/test2.tiff | cksum pamtotiff testgrid.pbm 1<>${tmpdir}/test3.tiff && |