about summary refs log tree commit diff
path: root/test/stdin-ppm2.test
blob: 81b3954ed945da88b95eab4897a4a6364c06b327 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#! /bin/sh
# This script tests: ppmtoacad ppmtoapplevol ppmtoascii ppmtolj ppmtomitsu
# This script tests: ppmtopgm ppmtopuzz ppmtosixel ppmtoterm
# This script tests: ppmtoicr ppmtoyuvsplit
# Also requires: ppmpat

tmpdir=${tmpdir:-/tmp}
test_ppm=${tmpdir}/test.ppm
out1=${tmpdir}/out1
out2=${tmpdir}/out2

ppmpat -g2 -color=rgb:00/00/ff,rgb:ff/00/00 -mesh 12 12 > ${test_ppm}

# These converters do not have counterparts in the reverse direction

for testprog in  \
        ppmtoacad \
        ppmtoapplevol \
        ppmtoascii \
        ppmtolj \
        ppmtomitsu \
        ppmtopgm \
        ppmtopuzz \
        ppmtosixel \
        ppmtoterm
  do
  ${testprog} ${test_ppm} > ${out1};      status1=$?
  ${testprog} < ${test_ppm} > ${out2};    status2=$?
  test -s ${out1};                        status3=$?
  cmp -s ${out1} ${out2}
  echo ${testprog}": "${status1} ${status2} ${status3} $?
  rm ${out1} ${out2}
  done

rm ${test_ppm}

testprog=ppmtoicr

# File name embedded in output; "untitled" if no name

  ${testprog} testgrid.pbm > ${out1};     status1=$?
  ${testprog} < testgrid.pbm > ${out2};   status2=$?
  test -s ${out1};                        status3=$?
  sed 's/untitled/testgrid.pbm/g' ${out2} | cmp -s ${out1} -
  echo ${testprog}": "${status1} ${status2} ${status3} $?
  rm ${out1} ${out2}

testprog=ppmtoyuvsplit

# Produces three output files

  ${testprog} ${tmpdir}/base testgrid.pbm;     status1=$?
  cat ${tmpdir}/base.Y  ${tmpdir}/base.U  ${tmpdir}/base.V > ${out1}
  rm ${tmpdir}/base.Y  ${tmpdir}/base.U  ${tmpdir}/base.V

  ${testprog} ${tmpdir}/base < testgrid.pbm;   status2=$?
  cat ${tmpdir}/base.Y  ${tmpdir}/base.U  ${tmpdir}/base.V > ${out2}
  rm ${tmpdir}/base.Y  ${tmpdir}/base.U  ${tmpdir}/base.V
  test -s ${out1};                             status3=$?
  cmp -s ${out1} ${out2}
  echo ${testprog}": "${status1} ${status2} ${status3} $?
  rm ${out1} ${out2}

# Ppmtoppm input is from standard input

# Ppmtoapplevol height must be 12
# Ppmtoarbtxt needs body template file
# Ppmtompeg parameter file must be given