about summary refs log tree commit diff
path: root/test
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2023-09-23 17:24:46 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2023-09-23 17:24:46 +0000
commit3809252d2a17c8570e63c66bcd7d9ee2bfaae807 (patch)
treedc0bb5f69d65c4ae9799e7bd4f575c219ec9f235 /test
parent6e6126925ecb9f12f4d9ee36e1f4f1a465477b9d (diff)
downloadnetpbm-mirror-3809252d2a17c8570e63c66bcd7d9ee2bfaae807.tar.gz
netpbm-mirror-3809252d2a17c8570e63c66bcd7d9ee2bfaae807.tar.xz
netpbm-mirror-3809252d2a17c8570e63c66bcd7d9ee2bfaae807.zip
Add ybm, JPEG scans test, improve xpm, cis tests
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4682 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'test')
-rw-r--r--test/Test-Order3
-rw-r--r--test/cis-roundtrip.ok5
-rwxr-xr-xtest/cis-roundtrip.test13
-rw-r--r--test/pnmtojpeg-scans.ok20
-rwxr-xr-xtest/pnmtojpeg-scans.test32
-rw-r--r--test/test.jpegscan13
-rw-r--r--test/xpm-roundtrip.ok3
-rwxr-xr-xtest/xpm-roundtrip.test6
-rw-r--r--test/ybm-roundtrip.ok2
-rwxr-xr-xtest/ybm-roundtrip.test7
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