blob: e7ab4efb90235efe0e15368163f11a4f92e587c9 (
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
|
#! /bin/sh
# This script tests: pamchannel
# Also requires: pamtopam pamtopnm
# Extract planes one by one.
# Convert output to pgm to make it identical to ppmtorgb3 output.
# $ ppmtorgb3 testimg.ppm ; cksum testimg.{red,grn,blu}
#
# 1571496937 33838 testimg.red
# 394856971 33838 testimg.grn
# 3164158573 33838 testimg.blu
echo "Test 1:red-channel Should produce 1571496937 33838"
pamchannel -infile testimg.ppm 0 | \
pamtopnm --assume | cksum
echo "Test 2:green-channel Should produce 394856971 33838"
pamchannel -infile testimg.ppm -tupletype="GRAYSCALE" 1 | \
pamtopnm | cksum
echo "Test 3:blue-channel Should produce 3164158573 33838"
pamchannel -infile testimg.ppm 2 | \
pamtopnm --assume | cksum
echo "Test 4:single-channel Should produce 281226646 481"
pamchannel -infile maze.pbm 0 | \
pamtopnm --assume | cksum
# Test invalid: specified channel does not exist
echo 1>&2
echo "Invalid command-line argument combinations." 1>&2
echo "Error messages should appear below the line." 1>&2
echo "-----------------------------------------------------------" 1>&2
tmpdir=${tmpdir:-/tmp}
test_out=${tmpdir}/test_out
echo "Test Invalid"
. ./test-invalid.inc
invCmd "pamchannel -infile testgrid.pbm 1"
invCmd "pamchannel -infile testimg.ppm 3"
invCmd "pamtopam testimg.ppm | pamchannel -infile=- 4"
|