diff options
Diffstat (limited to 'test')
-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/ppmchange.ok | 9 | ||||
-rwxr-xr-x | test/ppmchange.test | 39 | ||||
-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 | 7 | ||||
-rwxr-xr-x | test/tiff-flate-lzw-roundtrip.test | 33 | ||||
-rw-r--r-- | test/tiff-roundtrip.ok | 4 | ||||
-rwxr-xr-x | test/tiff-roundtrip.test | 26 |
18 files changed, 219 insertions, 50 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/ppmchange.ok b/test/ppmchange.ok index 130c3c45..aba3a7a8 100644 --- a/test/ppmchange.ok +++ b/test/ppmchange.ok @@ -1,4 +1,9 @@ 22488533 203 1008787190 613 -3885709071 613 -2101746192 613 +1983174784 613 +2146447222 613 +1216791938 613 + 0 0 0 0 78 + 0 0 255 29 40 + 0 50 2 30 41 + 100 0 1 30 41 diff --git a/test/ppmchange.test b/test/ppmchange.test index 397b290f..a749a5d2 100755 --- a/test/ppmchange.test +++ b/test/ppmchange.test @@ -1,6 +1,6 @@ #! /bin/bash # This script tests: ppmchange -# Also requires: ppmrainbow pgmramp +# Also requires: ppmrainbow pgmramp ppmhist # Failure message @@ -10,9 +10,10 @@ tmpdir=${tmpdir:-/tmp} rainbow_ppm=${tmpdir}/rainbow.ppm +changed_ppm=${tmpdir}/changed.ppm -# Explicit values for intermediate colors: rgb.txt may be defining them -# in unusual ways. +# Explicit values for intermediate colors: rgb.txt may not be the one +# Netpbm provides; they may be defined in unusual ways. brown=rgb:67/43/00 cyan=rgb:00/ff/ff @@ -20,7 +21,7 @@ yellow=rgb:ff/ff/00 gray=rgb:7f/7f/7f -# Test 1. Should print 811868957 60 +# Test 1. Should print 22488533 203 pgmramp -lr 8 8 | ppmchange black black white white $gray $gray \ -close=10 -remainder=blue | cksum @@ -31,29 +32,31 @@ ppmrainbow -tmpdir=$tmpdir -width=200 -height=1 red green blue | \ tee ${rainbow_ppm} | \ ppmchange red $brown green $brown blue $brown | cksum +# Validate ${rainbow_ppm} +# Should print 1983174784 613 -# Test 3. Should print 3885709071 613 +cat ${rainbow_ppm} | cksum + + +# Test 3. Should print 2146447222 613 ppmchange red $brown green $cyan blue $yellow \ -closeness=25 ${rainbow_ppm} | cksum -# Test 4. Should print 2101746192 613 +# Test 4. Should print 1216791938 613 ppmchange red rgb:64/00/01 rgb:00/ff/00 rgb:00/32/02 blue blue \ - -remainder=black -closeness=25 ${rainbow_ppm} | cksum + -remainder=black -closeness=25 ${rainbow_ppm} | tee ${changed_ppm} | cksum -rm ${rainbow_ppm} +# Produce a histogram of the colors in the output image +# Should produce +# 0 0 0 0 78 +# 0 0 255 29 40 +# 0 50 2 30 41 +# 100 0 1 30 41 +ppmhist -sort=rgb -noheader ${changed_ppm} -# cksum ${rainbow_ppm} -# 1983174784 613 rainbow.ppm -# ppmchange red rgb:64/00/01 rgb:00/ff/00 rgb:00/32/02 blue blue \ -# -remainder=black -closeness=25 ${rainbow_ppm} | \ -# pphist -sort=rgb -noheader -# -# 0 0 0 0 75 -# 0 0 255 29 42 -# 0 50 2 30 42 -# 100 0 1 30 41 +rm ${rainbow_ppm} ${changed_ppm} 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..0ee3e083 --- /dev/null +++ b/test/tiff-flate-lzw-roundtrip.ok @@ -0,0 +1,7 @@ +764594701 101484 +764594701 101484 +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..7e28a899 --- /dev/null +++ b/test/tiff-flate-lzw-roundtrip.test @@ -0,0 +1,33 @@ +#! /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}/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 + +# test flate compression +pamtotiff -flate ${test40_ppm} | tifftopnm | cksum + +# test adobeflate compression +pamtotiff -adobeflate ${test40_ppm} | tifftopnm | cksum + +# test LZW compression +pamtotiff -lzw ${test40_ppm} | tifftopnm | cksum +pamtotiff -lzw -predictor=1 ${test40_ppm} | tifftopnm | cksum + +# PBM image: test flate compression +pamtotiff -flate testgrid.pbm | tifftopnm | cksum + +rm ${test40_ppm} diff --git a/test/tiff-roundtrip.ok b/test/tiff-roundtrip.ok index 0e712ce7..f6f04103 100644 --- a/test/tiff-roundtrip.ok +++ b/test/tiff-roundtrip.ok @@ -1,4 +1,8 @@ 1926073387 101484 1926073387 101484 +1926073387 101484 +1926073387 101484 +1926073387 101484 +2425386270 41 2425386270 41 2425386270 41 diff --git a/test/tiff-roundtrip.test b/test/tiff-roundtrip.test index 624337f1..747006b3 100755 --- a/test/tiff-roundtrip.test +++ b/test/tiff-roundtrip.test @@ -3,20 +3,22 @@ # Also requires: # Failure message -## Second test fails if Netpbm was built without the flate library +## If this test fails, the cause may be a problem in the TIFF library. -pamtotiff testimg.ppm 1<>${tmpdir}/test1.tiff && - tifftopnm ${tmpdir}/test1.tiff | cksum +# PPM image +# Should print 1926073387 101484 five times -# test flate compression -pamtotiff -flate testimg.ppm 1<>${tmpdir}/test2.tiff && - tifftopnm ${tmpdir}/test2.tiff | cksum +pamtotiff testimg.ppm | tifftopnm | cksum +pamtotiff -truecolor testimg.ppm | tifftopnm | cksum -pamtotiff testgrid.pbm 1<>${tmpdir}/test3.tiff && - tifftopnm ${tmpdir}/test3.tiff | cksum +pamtotiff -truecolor -packbits testimg.ppm | tifftopnm | cksum +pamtotiff -truecolor -rowsperstrip=2 testimg.ppm | tifftopnm | cksum +pamtotiff -truecolor -lsb2msb testimg.ppm | \ + tifftopnm -respectfillorder | cksum -# test G4 compression -pamtotiff -g4 testgrid.pbm 1<>${tmpdir}/test4.tiff && - tifftopnm ${tmpdir}/test4.tiff | cksum +# PBM image +# Should print 2425386270 41 three times -rm ${tmpdir}/test[1234].tiff +pamtotiff testgrid.pbm | tifftopnm | cksum +pamtotiff -g3 -fill testgrid.pbm | tifftopnm | cksum +pamtotiff -g4 testgrid.pbm | tifftopnm | cksum |