about summary refs log tree commit diff
path: root/test/bmp-roundtrip.test
blob: 340eee662ee0b25a2d1db6f03ebc20d33513360b (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
#! /bin/sh
# This script tests: bmptopnm ppmtobmp
# Also requires: pamchannel pamtopnm pamseq

tmpdir=${tmpdir:-/tmp}

echo "Test 1 PBM.  Should print 281226646 481 four times"

for mode in "" "-bpp=1" "-windows" "-os2"
  do
  ppmtobmp ${mode} maze.pbm | bmptopnm | cksum
  done

echo "Test 2 PPM.  Should print 1926073387 101484 four times"

for mode in "" "-bpp=24" "-windows" "-os2"
  do
  ppmtobmp ${mode} testimg.ppm | bmptopnm | cksum
  done

echo "Test 3 PGM.  Should print 1571496937 33838 nine times"

red_pgm=${tmpdir}/red.pgm
mapfile_pgm=${tmpdir}/mapfile.pgm
pamseq -tupletype="GRAYSCALE" 1 255 > ${mapfile_pgm}

pamchannel -infile=testimg.ppm -tupletype="GRAYSCALE" 0 | \
    pamtopnm | tee ${red_pgm} | cksum

for mode in "" "-bpp=8" "-windows" "-os2"
  do
  ppmtobmp ${mode} ${red_pgm} | bmptopnm | cksum
  ppmtobmp ${mode} -mapfile=${mapfile_pgm} ${red_pgm} | bmptopnm | cksum
  done

rm ${mapfile_pgm} ${red_pgm}