about summary refs log tree commit diff
path: root/test/ppmtoarbtxt-roundtrip.test
diff options
context:
space:
mode:
Diffstat (limited to 'test/ppmtoarbtxt-roundtrip.test')
-rwxr-xr-xtest/ppmtoarbtxt-roundtrip.test34
1 files changed, 34 insertions, 0 deletions
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}