about summary refs log tree commit diff
path: root/test/stdin-pnm2.test
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2022-02-03 01:26:10 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2022-02-03 01:26:10 +0000
commitbe71d9f416a205d4dd977b93f5f96f97e8628cca (patch)
tree0426e2bf871948b1a3994a74671f75a3ec8a06e0 /test/stdin-pnm2.test
parent458cce2de894fb6d9383896d1cbd309ece582b34 (diff)
downloadnetpbm-mirror-be71d9f416a205d4dd977b93f5f96f97e8628cca.tar.gz
netpbm-mirror-be71d9f416a205d4dd977b93f5f96f97e8628cca.tar.xz
netpbm-mirror-be71d9f416a205d4dd977b93f5f96f97e8628cca.zip
Add stdin tests, et al
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4272 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'test/stdin-pnm2.test')
-rwxr-xr-xtest/stdin-pnm2.test77
1 files changed, 77 insertions, 0 deletions
diff --git a/test/stdin-pnm2.test b/test/stdin-pnm2.test
new file mode 100755
index 00000000..ee97c992
--- /dev/null
+++ b/test/stdin-pnm2.test
@@ -0,0 +1,77 @@
+#! /bin/sh
+# This script tests: pnmtofiasco fiascotopnm pnmtojbig jbigtopnm pnmtojpeg
+# This script tests: jpegtopnm pnmtopalm palmtopnm pnmtopng pngtopam pnmtops
+# This script tests: pstopnm pnmtorast rasttopnm pnmtorle rletopnm pnmtosgi
+# This script tests: sgitopnm pnmtosir sirtopnm pnmtoxwd xwdtopnm pnmtotiffcmyk
+# This script tests: tifftopnm
+# Also requires: pgmramp
+
+tmpdir=${tmpdir:-/tmp}
+test_pgm=${tmpdir}/test.pgm
+out1=${tmpdir}/out1
+out2=${tmpdir}/out2
+out3=${tmpdir}/out3
+out4=${tmpdir}/out4
+
+pgmramp -diag 32 32 > ${test_pgm}
+
+echo "Test.  Should print (command): 0 0 0"
+echo "The following are exceptions: should print (command): 0 0 1"
+echo "pnmtops, pstopnm, pnmtorle, pnmtoxwd, pnmtotiffcmyk"
+echo
+
+for fmt in  \
+        fiasco \
+        jbig \
+        jpeg \
+        palm \
+        png \
+        ps \
+        rast \
+        rle \
+        sgi \
+        sir \
+        xwd \
+	tiffcmyk
+  do
+
+  if [ ${fmt} = "fiasco" ]
+    then testprog1="pnmto"${fmt}" --progress-meter 0 ";
+  else
+      testprog1="pnmto"${fmt};
+  fi
+
+  if [ ${fmt} = "png" ]
+    then testprog2=${fmt}"topam";
+  elif [ ${fmt} = "tiffcmyk" ]
+    then testprog2="tifftopnm";
+  else
+    testprog2=${fmt}"topnm";
+  fi
+
+  ${testprog1} ${test_pgm} > ${out1};   status1=$?
+  ${testprog1} < ${test_pgm} > ${out2}; status2=$?
+  cmp -s ${out1} ${out2}
+  echo ${testprog1}": "${status1} ${status2} $?  
+
+  ${testprog2} ${out1} > ${out3};       status3=$?
+  ${testprog2} < ${out1} > ${out4};     status4=$?
+  cmp -s ${out3} ${out4}
+  echo ${testprog2}": "${status3} ${status4} $?
+
+  rm ${out1} ${out2} ${out3} ${out4}
+  done
+
+rm ${test_pgm}
+
+
+# pnmtofiasco  width, height must be even and at least 32
+# 
+# pnmtojbig    input must be bilevel black-white or gray
+# pnmtops      input file name embedded in output
+# pnmtorle     input file name, creation time embedded in output
+#              file name blank when input is from stdin
+# pnmtotiffcmyk  input file name embedded in output
+#                "Standard input" if from stdin
+# pnmtoxwd     input file name embedded in output
+#              "stdin" if from stdin