diff options
-rw-r--r-- | test/Test-Order | 3 | ||||
-rw-r--r-- | test/cis-roundtrip.ok | 5 | ||||
-rwxr-xr-x | test/cis-roundtrip.test | 13 | ||||
-rw-r--r-- | test/pnmtojpeg-scans.ok | 20 | ||||
-rwxr-xr-x | test/pnmtojpeg-scans.test | 32 | ||||
-rw-r--r-- | test/test.jpegscan | 13 | ||||
-rw-r--r-- | test/xpm-roundtrip.ok | 3 | ||||
-rwxr-xr-x | test/xpm-roundtrip.test | 6 | ||||
-rw-r--r-- | test/ybm-roundtrip.ok | 2 | ||||
-rwxr-xr-x | test/ybm-roundtrip.test | 7 |
10 files changed, 83 insertions, 21 deletions
diff --git a/test/Test-Order b/test/Test-Order index 63a071d9..05742ac0 100644 --- a/test/Test-Order +++ b/test/Test-Order @@ -175,6 +175,8 @@ rawtoppm.test gif-transparent1.test +pnmtojpeg-scans.test + # Miscellaneous utility tests ppmdfont.test @@ -264,6 +266,7 @@ xbm-roundtrip.test xpm-roundtrip.test xv-roundtrip.test xwd-roundtrip.test +ybm-roundtrip.test # Round-trip tests : lossy converters diff --git a/test/cis-roundtrip.ok b/test/cis-roundtrip.ok index 1bb50cb7..8cac8da6 100644 --- a/test/cis-roundtrip.ok +++ b/test/cis-roundtrip.ok @@ -1,5 +1,8 @@ Test 1. Should print 2631579683 1546 twice 2631579683 1546 2631579683 1546 -Test 2. Should print 281226646 481, cksum of maze.pbm +Test 2. Should print 281226646 481, cksum of maze.pbm four times +281226646 481 +281226646 481 +281226646 481 281226646 481 diff --git a/test/cis-roundtrip.test b/test/cis-roundtrip.test index ad34173e..3316868c 100755 --- a/test/cis-roundtrip.test +++ b/test/cis-roundtrip.test @@ -1,6 +1,6 @@ #! /bin/sh # This script tests: pbmtocis cistopbm -# Also requires: pbmmake pamcut pamfile +# Also requires: pbmmake pamcut pamfile pnmcrop tmpdir=${tmpdir:-/tmp} test_pbm=${tmpdir}/test.pbm @@ -13,8 +13,11 @@ echo "Test 1. Should print 2631579683 1546 twice" pbmmake -g 128 96 | tee ${test_pbm} | cksum pbmtocis ${test_pbm} | cistopbm | cksum -echo "Test 2. Should print 281226646 481, cksum of maze.pbm" -size=$(pamfile -size maze.pbm | awk '{print "-width="$1,"-height="$2}') -pbmtocis maze.pbm | cistopbm | pamcut -left=0 -top=0 ${size} | cksum +rm ${test_pbm} -rm ${test_pbm} \ No newline at end of file +echo "Test 2. Should print 281226646 481, cksum of maze.pbm four times" +size=$(pamfile -size maze.pbm | awk '{print "-width="$1,"-height="$2}') +pbmtocis maze.pbm | cistopbm | pamcut -left=0 -top=0 ${size} | cksum +pbmtocis -i maze.pbm | cistopbm -i | pamcut -left=0 -top=0 ${size} | cksum +pbmtocis maze.pbm | cistopbm | pnmcrop -black -right -bottom | cksum +pbmtocis -w maze.pbm | cistopbm | pnmcrop -white -right -bottom | cksum diff --git a/test/pnmtojpeg-scans.ok b/test/pnmtojpeg-scans.ok new file mode 100644 index 00000000..089dfebf --- /dev/null +++ b/test/pnmtojpeg-scans.ok @@ -0,0 +1,20 @@ +success +pnmtojpeg: Input file has format P6. +It has 149 rows of 227 columns of pixels with max sample value of 255. +pnmtojpeg: A scan script with 7 entries is being used: +pnmtojpeg: Scan 0: Ss= 0 Se= 0 Ah= 0 Al= 0 3 components +pnmtojpeg: Color component 0 index: 0 +pnmtojpeg: Color component 1 index: 1 +pnmtojpeg: Color component 2 index: 2 +pnmtojpeg: Scan 1: Ss= 1 Se= 2 Ah= 0 Al= 0 1 components +pnmtojpeg: Color component 0 index: 0 +pnmtojpeg: Scan 2: Ss= 3 Se= 5 Ah= 0 Al= 0 1 components +pnmtojpeg: Color component 0 index: 0 +pnmtojpeg: Scan 3: Ss= 1 Se=63 Ah= 0 Al= 0 1 components +pnmtojpeg: Color component 0 index: 1 +pnmtojpeg: Scan 4: Ss= 1 Se=63 Ah= 0 Al= 0 1 components +pnmtojpeg: Color component 0 index: 2 +pnmtojpeg: Scan 5: Ss= 6 Se= 9 Ah= 0 Al= 0 1 components +pnmtojpeg: Color component 0 index: 0 +pnmtojpeg: Scan 6: Ss=10 Se=63 Ah= 0 Al= 0 1 components +pnmtojpeg: Color component 0 index: 0 diff --git a/test/pnmtojpeg-scans.test b/test/pnmtojpeg-scans.test new file mode 100755 index 00000000..ea17c8c0 --- /dev/null +++ b/test/pnmtojpeg-scans.test @@ -0,0 +1,32 @@ +#! /bin/bash +# This script tests: pnmtojpeg +# Also requires: + +tmpdir=${tmpdir:-/tmp} +test_jpegscan=${tmpdir}/test.jpegscan +err_out=${tmpdir}/err.out + +cat > ${test_jpegscan} << EOF +# This is a example of a scan script to be used by 'pnmtojpeg' with -scan . +# It should work with any color image. + +#Interleaved DC scan for Y, Cb, Cr: +0, 1, 2: 0-0, 0, 0 ; + +# AC scans: +0: 1- 2, 0, 0 ; +0: 3- 5, 0, 0 ; +1: 1-63, 0, 0 ; +2: 1-63, 0, 0 ; +0: 6- 9, 0, 0 ; +0: 10-63, 0, 0 ; +EOF + +pnmtojpeg testimg.ppm -scans=${test_jpegscan} -verbose \ + > /dev/null 2> ${err_out} && echo "success" || echo "failure" + +cat ${err_out} + +rm ${err_out} ${test_jpegscan} + +# TODO test invalid scan script diff --git a/test/test.jpegscan b/test/test.jpegscan deleted file mode 100644 index 7a659b7f..00000000 --- a/test/test.jpegscan +++ /dev/null @@ -1,13 +0,0 @@ -# This is a example of a scan script to be used by 'pnmtojpeg' with -scan . -# It should work with any color image. - -#Interleaved DC scan for Y, Cb, Cr: -0, 1, 2: 0-0, 0, 0 ; - -# AC scans: -0: 1- 2, 0, 0 ; -0: 3- 5, 0, 0 ; -1: 1-63, 0, 0 ; -2: 1-63, 0, 0 ; -0: 6- 9, 0, 0 ; -0: 10-63, 0, 0 ; diff --git a/test/xpm-roundtrip.ok b/test/xpm-roundtrip.ok index 5168378d..2083dc10 100644 --- a/test/xpm-roundtrip.ok +++ b/test/xpm-roundtrip.ok @@ -1 +1,4 @@ +Test 1. Should print 1926073387 101484 +1926073387 101484 +Test 2. Should print 281226646 481 281226646 481 diff --git a/test/xpm-roundtrip.test b/test/xpm-roundtrip.test index 6e3e415b..c016c8c3 100755 --- a/test/xpm-roundtrip.test +++ b/test/xpm-roundtrip.test @@ -2,8 +2,10 @@ # This script tests: ppmtoxpm xpmtoppm # Also requires: pgmtopbm ppmtopgm +echo "Test 1. Should print 1926073387 101484" +ppmtoxpm -hexonly testimg.ppm | \ + xpmtoppm | cksum -#ppmtoxpm -hexonly testimg.ppm | \ -# xpmtoppm | cksum +echo "Test 2. Should print 281226646 481" ppmtoxpm maze.pbm | xpmtoppm | \ ppmtopgm | pgmtopbm -th -value=0.5 | cksum diff --git a/test/ybm-roundtrip.ok b/test/ybm-roundtrip.ok new file mode 100644 index 00000000..3873d097 --- /dev/null +++ b/test/ybm-roundtrip.ok @@ -0,0 +1,2 @@ +Test. Should print 281226646 481 +281226646 481 diff --git a/test/ybm-roundtrip.test b/test/ybm-roundtrip.test new file mode 100755 index 00000000..b53d2ba0 --- /dev/null +++ b/test/ybm-roundtrip.test @@ -0,0 +1,7 @@ +#! /bin/sh +# This script tests: pbmtoybm xbmtopbm +# Also requires: + +echo "Test. Should print 281226646 481" + +pbmtoybm maze.pbm | ybmtopbm | cksum |