about summary refs log tree commit diff
path: root/test/palm-roundtrip.test
blob: 20fcefa90360af830df5d3c0f1b47f0a6542e5b6 (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
#! /bin/bash
# This script tests: pnmtopalm palmtopnm
# Also requires: pamdepth pnmquant

tmpdir=${tmpdir:-/tmp}
test4bit_pgm=${tmpdir}/test4bit.pgm
test256color_ppm=${tmpdir}/test256color.ppm

echo "Test 1. Should print 2067616594 3375 five times"

pamdepth 15 maze.pbm | tee ${test4bit_pgm} | cksum

for flags in "" \
             "-scanline_compression" \
             "-rle_compression" \
             "-packbits_compression"
  do pnmtopalm $flags ${test4bit_pgm} | palmtopnm | cksum; done

rm ${test4bit_pgm}


echo "Test 2. Should print 0 0 0  : 0 four times"

pnmquant 256 testimg.ppm > ${test256color_ppm} || echo "pnmquant failed"

for flags in "" \
             "-scanline_compression" \
             "-rle_compression" \
             "-packbits_compression" 
  do pnmtopalm -colormap $flags ${test256color_ppm} | palmtopnm | \
     cmp -s - ${test256color_ppm} > /dev/null
     echo ${PIPESTATUS[@]} ":" $?
  done

rm ${test256color_ppm}