about summary refs log tree commit diff
path: root/test/stdin-pbm2.test
blob: ba585516e81bb745228577002ba812475d30bea8 (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
69
70
71
72
73
74
75
76
77
78
#! /bin/sh
# This script tests: atktopbm pbmtoatk
# This script tests: cistopbm pbmtocis
# This script tests: cmuwmtopbm pbmtocmuwm
# This script tests: escp2topbm pbmtoescp2
# This script tests: g3topbm pbmtog3
# This script tests: gemtopnm pbmtogem
# This script tests: macptopbm pbmtomacp
# This script tests: mdatopbm pbmtomda
# This script tests: mgrtopbm pbmtomgr
# This script tests: mrftopbm pbmtomrf
# This script tests: pi3topbm pbmtopi3
# This script tests: sunicontopnm pbmtosunicon
# This script tests: wbmptopbm pbmtowbmp
# This script tests: ybmtopbm pbmtoybm
# Also requires:

tmpdir=${tmpdir:-/tmp}
out1=${tmpdir}/out1
out2=${tmpdir}/out2
out3=${tmpdir}/out3
out4=${tmpdir}/out4

for fmt in  \
        atk \
        cis \
        cmuwm \
        escp2 \
        g3 \
        gem \
        macp \
        mda \
        mgr \
        mrf \
        pi3 \
        sunicon \
        wbmp \
        ybm
  do
  testprog1="pbmto"${fmt}

  if [ ${fmt} = "sunicon" -o ${fmt} = "gem" ];
    then testprog2=${fmt}"topnm";
    else testprog2=${fmt}"topbm";
  fi

  ${testprog1} testgrid.pbm > ${out1};     status1=$?
  ${testprog1} < testgrid.pbm > ${out2};   status2=$?
  test -s ${out1};                         status3=$?
  cmp -s ${out1} ${out2}
  echo ${testprog1}": "${status1} ${status2} ${status3} $?
  rm ${out2}

  ${testprog2} ${out1} > ${out3};      status3=$?
  ${testprog2} < ${out1} > ${out4};    status4=$?

  if [ ${fmt} = "xbm" ];
    then sed -i '3s/noname/testgrid/' ${out3};
  fi

  test -s ${out3};                         status5=$?
  cmp -s ${out3} ${out4}
  echo ${testprog2}": "${status3} ${status4} ${status5} $?
  rm ${out1} ${out3} ${out4}
  done

# We don't test Pbmtopgm Pgmtopbm Asciitopbm Asciitopgm here

# Pbmtopk Pktopbm require resolution output pk file, tk file
#            some conditions apply to input image dimensions

# These three programs embed the input file name in the output
# If the input is from stdin, "noname"
# Pbmtolps tested in lps-roundtrip.test
# Pbmtoxbm           xbm-roundtrip.test
# Pbmtozinc          pbm-misc-converters.test

# Icontopbm Pbmtoicon Pbmtox10bm are legacy