about summary refs log tree commit diff
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2015-04-17 15:20:06 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2015-04-17 15:20:06 +0000
commit2b398bac6127e1512be09eca1e1d67559c32c7c6 (patch)
tree49df2874254b0fe7fb1b76c34b0d724e6e7277e6
parentdaf35c1b334b76ba0d66d872cf9fb50864bacba9 (diff)
downloadnetpbm-mirror-2b398bac6127e1512be09eca1e1d67559c32c7c6.tar.gz
netpbm-mirror-2b398bac6127e1512be09eca1e1d67559c32c7c6.tar.xz
netpbm-mirror-2b398bac6127e1512be09eca1e1d67559c32c7c6.zip
Add round-trip tests for 'xv', 'ppmtoarbtxt'; better cover compression scheme in macptoppm test
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@2464 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r--test/Test-Order2
-rw-r--r--test/macp-roundtrip.ok5
-rwxr-xr-xtest/macp-roundtrip.test31
-rwxr-xr-xtest/ppmdfont.test4
-rw-r--r--test/ppmtoarbtxt-roundtrip.ok2
-rwxr-xr-xtest/ppmtoarbtxt-roundtrip.test34
-rw-r--r--test/xv-roundtrip.ok1
-rwxr-xr-xtest/xv-roundtrip.test7
8 files changed, 79 insertions, 7 deletions
diff --git a/test/Test-Order b/test/Test-Order
index 064daf94..d21b9e8a 100644
--- a/test/Test-Order
+++ b/test/Test-Order
@@ -103,6 +103,7 @@ pamslice-roundtrip.test
 
 # Round-trip tests : lossless converters
 
+ppmtoarbtxt-roundtrip.test
 atari-roundtrip.test
 atk-roundtrip.test
 avs-roundtrip.test
@@ -141,6 +142,7 @@ wbmp-roundtrip.test
 winicon-roundtrip.test
 xbm-roundtrip.test
 xpm-roundtrip.test
+xv-roundtrip.test
 xwd-roundtrip.test
 
 # Round-trip tests : lossy converter
diff --git a/test/macp-roundtrip.ok b/test/macp-roundtrip.ok
index 20e24348..9ff9d249 100644
--- a/test/macp-roundtrip.ok
+++ b/test/macp-roundtrip.ok
@@ -1,2 +1,5 @@
 2425386270 41
-1005016577 51851
+2425386270 41
+2329957971 51851
+2907103393 5086
+2907103393 5086
diff --git a/test/macp-roundtrip.test b/test/macp-roundtrip.test
index 2d7f6ce3..4774a2c2 100755
--- a/test/macp-roundtrip.test
+++ b/test/macp-roundtrip.test
@@ -1,10 +1,31 @@
 #! /bin/bash
 # This script tests: pbmtomacp macptopbm
-# Also requires: pnmcrop pbmmake
+# Also requires: pnmcrop pbmpage pbmupc pnmpad
 
+tmpdir=${tmpdir:-/tmp}
+temp1_pbm=${tmpdir}/temp1.ppm
+temp2_pbm=${tmpdir}/temp2.ppm
 
-#Test 1. Should produce 2425386270 41
-pbmtomacp testgrid.pbm | macptopbm | pnmcrop | cksum
 
-#Test 2. Should produce 1005016577 51851
-pbmmake -g 576 720 | pbmtomacp | macptopbm | cksum
+# Test 1. Should produce 2425386270 41 twice
+# Because Macpaint files are fixed size (576 x 720 pixels)
+# pbmtomacp automatically adds padding when input is smaller.
+
+pbmtomacp testgrid.pbm | macptopbm | tee ${temp1_pbm} | \
+    pnmcrop | cksum
+
+pbmtomacp ${temp1_pbm} | macptopbm | pnmcrop | cksum
+
+
+#Test 2. Should produce 2329957971 51851
+pbmpage 1 | pbmtomacp | macptopbm | cksum
+
+
+#Test 3. Should produce 2907103393 5086 twice
+pbmupc 0 12345 67890 | pnmpad -black -t 44 -b 20 -l 100 -r 251 | pbmtomacp | macptopbm | \
+    tee ${temp2_pbm} | \
+    pnmcrop | pnmcrop | cksum
+
+pbmtomacp ${temp2_pbm} | macptopbm | pnmcrop | pnmcrop | cksum
+
+rm ${temp1_pbm} ${temp2_pbm}
diff --git a/test/ppmdfont.test b/test/ppmdfont.test
index 03110590..7d894789 100755
--- a/test/ppmdfont.test
+++ b/test/ppmdfont.test
@@ -9,7 +9,9 @@ ppmdmkfont | ppmddumpfont 2>&1 | cksum
 # Test 2. Should produce: 2845495212 75033
 ppmdmkfont | ppmdcfont | cksum
 
-# There is a strange glitch in output when ppmdcfont is compiled by clang:
+# There is a strange glitch in output when ppmdcfont is compiled by
+# clang version 3.2.  Optimization (-O3) seems to be a factor.
+# 
 # 3171,3173c3171,3173
 # <     0x01,
 # <     95,
diff --git a/test/ppmtoarbtxt-roundtrip.ok b/test/ppmtoarbtxt-roundtrip.ok
new file mode 100644
index 00000000..a29d1c2b
--- /dev/null
+++ b/test/ppmtoarbtxt-roundtrip.ok
@@ -0,0 +1,2 @@
+1926073387 101484
+1926073387 101484
diff --git a/test/ppmtoarbtxt-roundtrip.test b/test/ppmtoarbtxt-roundtrip.test
new file mode 100755
index 00000000..dff78250
--- /dev/null
+++ b/test/ppmtoarbtxt-roundtrip.test
@@ -0,0 +1,34 @@
+#! /bin/bash
+# This script tests: ppmtoarbtxt
+# Also requires: pnminvert pamtopnm
+
+# Test.  Invert colors.
+# Should print 1926073387 101484
+
+tmpdir=${tmpdir:-/tmp}
+headskl=${tmpdir}/headskl
+bodyskl=${tmpdir}/bodyskl
+inv_ppm=${tmpdir}/inv.ppm
+
+cat > ${headskl} << EOF
+P3
+#(width) #(height)
+255
+
+EOF
+
+cat > ${bodyskl} << EOF
+#(ired %d 255 0) #(igreen %d 255 0) #(iblue %d 255 0)
+
+EOF
+
+ppmtoarbtxt ${bodyskl} -hd ${headskl} testimg.ppm | tee ${inv_ppm} |
+  pnminvert | cksum
+
+
+# Test 2.
+
+cat ${inv_ppm} | ppmtoarbtxt ${bodyskl} -hd ${headskl} | pamtopnm | cksum
+
+
+rm ${bodyskl} ${headskl}
diff --git a/test/xv-roundtrip.ok b/test/xv-roundtrip.ok
new file mode 100644
index 00000000..ac7f0d99
--- /dev/null
+++ b/test/xv-roundtrip.ok
@@ -0,0 +1 @@
+2418728144 101484
diff --git a/test/xv-roundtrip.test b/test/xv-roundtrip.test
new file mode 100755
index 00000000..d73933a1
--- /dev/null
+++ b/test/xv-roundtrip.test
@@ -0,0 +1,7 @@
+#! /bin/bash
+# This script tests: pamtoxvmini xvminitoppm
+# Also requires: pamdepth
+
+# Test.  Should print 2418728144 101484
+
+pamdepth 3 testimg.ppm | pamtoxvmini | xvminitoppm | cksum