blob: 91acf109a9a7c27ab872bc291403ae5717b44d62 (
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
|
#! /bin/bash
# This script tests: pamtotga tgatoppm
# Also requires: ppmtopgm pgmtopbm pamchannel pnmquant
tmpdir=${tmpdir:-/tmp}
#Test 1: Should print 2425386270 41, cksum of testgrid.pbm, eight times
echo "Test 1"
for mode in "-mono" "-mono -norle" "-cmap" "-cmap -norle" \
"-rgb" "-rgb -norle" "" "-norle"
do
pamtotga ${mode} testgrid.pbm | \
tgatoppm | ppmtopgm | \
pgmtopbm -threshold -val 0.5 | cksum
done
#Test 2: Should produce 1571496937 33838, cksum of testimg.red, eight times
echo "Test 2"
test_pam=${tmpdir}/testimg.pgm
pamchannel -infile=testimg.ppm -tupletype="GRAYSCALE" 0 > ${test_pam}
for mode in "-mono" "-mono -norle" "-cmap" "-cmap -norle" \
"-rgb" "-rgb -norle" "" "-norle"
do
pamtotga ${mode} ${test_pam} | tgatoppm | ppmtopgm | cksum
done
rm ${test_pam}
#Test 3: Should print 1926073387 101484, cksum of testimg.ppm, four times
echo "Test 3"
for mode in "-rgb" "-rgb -norle" "" "-norle"
do
pamtotga ${mode} testimg.ppm | tgatoppm | cksum
done
#Test 4: Should print 0 four times
echo "Test 4"
test256_ppm=${tmpdir}/test256.ppm
pnmquant 256 testimg.ppm > ${test256_ppm}
for mode in "-rgb" "-rgb -norle" "" "-norle"
do
pamtotga ${mode} ${test256_ppm} | tgatoppm | cmp -s - ${test256_ppm}
echo $?
done
rm ${test256_ppm}
|