about summary refs log tree commit diff
path: root/test/cis-roundtrip.test
blob: 3316868ca390ddfb1dcd030cbf1635a2746cb825 (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
#! /bin/sh
# This script tests: pbmtocis cistopbm
# Also requires: pbmmake pamcut pamfile pnmcrop

tmpdir=${tmpdir:-/tmp}
test_pbm=${tmpdir}/test.pbm

# Output images produced by pbmtocis are of fixed size,
# either 128x96 or 256x192.
# Smaller input images are padded, larger ones are cropped.

echo "Test 1. Should print 2631579683 1546 twice"
pbmmake -g 128 96 | tee ${test_pbm} | cksum
pbmtocis ${test_pbm} | cistopbm | cksum

rm ${test_pbm}

echo "Test 2. Should print 281226646 481, cksum of maze.pbm four times"
size=$(pamfile -size maze.pbm | awk '{print "-width="$1,"-height="$2}')
pbmtocis    maze.pbm | cistopbm    | pamcut -left=0 -top=0 ${size} | cksum
pbmtocis -i maze.pbm | cistopbm -i | pamcut -left=0 -top=0 ${size} | cksum
pbmtocis    maze.pbm | cistopbm    | pnmcrop -black -right -bottom | cksum
pbmtocis -w maze.pbm | cistopbm    | pnmcrop -white -right -bottom | cksum