about summary refs log tree commit diff
path: root/test/ppmtoarbtxt-roundtrip.test
blob: dff78250ecdf992f424716b853d2ad9102bb78ea (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
#! /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}