blob: 3c309259456c7e8d6202857d213cbf569950469b (
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
#! /bin/bash
# This script tests: rawtoppm
# Also requires: pamcut ppmtorgb3 rgb3toppm ppmtoppm
# Test 1
echo "Test 1: should print '0 0 : 0'"
rawtoppm -headerskip 15 227 149 testimg.ppm | cmp -s - testimg.ppm
echo ${PIPESTATUS[@]} ":" $?
# Test 2
echo "Test 2: should print '0 0 : 0' five times"
tmpdir=${tmpdir:-/tmp}
test0_ppm=${tmpdir}/test0.ppm
for i in 0 1 10 99 220
do
pamcut -cropright $i testimg.ppm > ${test0_ppm}
rawtoppm -headerskip 15 -rowskip $((i * 3)) $((227 - i)) 149 testimg.ppm | \
cmp -s ${test0_ppm} -
echo ${PIPESTATUS[@]} ":" $?
done
rm ${test0_ppm}
# Test 3
echo "Test 3: should print '0 0 0 : 0' five times"
ppmtorgb3 testimg.ppm
rgb3toppm testimg.red testimg.blu testimg.grn | \
rawtoppm -headerskip 15 -rbg 227 149 | cmp -s - testimg.ppm
echo ${PIPESTATUS[@]} ":" $?
rgb3toppm testimg.grn testimg.red testimg.blu | \
rawtoppm -headerskip 15 -grb 227 149 | cmp -s - testimg.ppm
echo ${PIPESTATUS[@]} ":" $?
rgb3toppm testimg.grn testimg.blu testimg.red | \
rawtoppm -headerskip 15 -gbr 227 149 | cmp -s - testimg.ppm
echo ${PIPESTATUS[@]} ":" $?
rgb3toppm testimg.blu testimg.red testimg.grn | \
rawtoppm -headerskip 15 -brg 227 149 | cmp -s - testimg.ppm
echo ${PIPESTATUS[@]} ":" $?
rgb3toppm testimg.blu testimg.grn testimg.red | \
rawtoppm -headerskip 15 -bgr 227 149 | cmp -s - testimg.ppm
echo ${PIPESTATUS[@]} ":" $?
# Test 4
echo "Test 4"
test1_ppm=${tmpdir}/test1.ppm
cat <<EOF > ${test1_ppm}
P3
5 5
9
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 5 5 5 5 5 9 9 9 9 9
0 1 2 3 4 0 1 2 3 4 0 1 2 3 4
0 1 2 3 4 1 2 3 4 5 2 3 4 5 6
9 8 7 6 5 4 3 2 1 0 0 0 0 0 0
EOF
ppmtoppm < ${test1_ppm} | rawtoppm -headerskip 9 5 5 -plain
rm ${test1_ppm} testimg.red testimg.grn testimg.blu
|