about summary refs log tree commit diff
path: root/test/pamrecolor.test
blob: b56747766981b90b018f4a2605839a00706b1a29 (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
#! /bin/sh
# This script tests: pamrecolor
# Also requires: ppmtopgm pgmmake

tmpdir=${tmpdir:-/tmp}
base_pgm=${tmpdir}/base.pgm

pgmmake 0.5 230 150 > ${base_pgm}

echo "Test 1. Should produce 3500040755 101532"

pamrecolor --colorfile=${base_pgm} testimg.ppm | cksum

echo "Test 2. Should produce 3500040755 101532 twice"

pamrecolor --targetcolor=rgb:80/80/80 testimg.ppm | cksum
pamrecolor --colorspace=ntsc --targetcolor=rgb:80/80/80 testimg.ppm | cksum

. ${srcdir}/test-invalid.inc

truncated_file=${tmpdir}/truncated.txt
echo P6 > ${truncated_file}

invCmd "pamrecolor --targetcolor=rgb:00/11/22 --colorfile=${base_pgm} testimg.ppm"
invCmd "pamrecolor --rmult=0.3  --gmult=0.3  --bmult=0.3 --colorfile=${base_pgm} testimg.ppm"
invCmd "pamrecolor --colorspace=void --targetcolor=rgb:80/80/80 testimg.ppm"
invCmd "pamrecolor --targetcolor=vague testimg.ppm"
invCmd "pamrecolor --colorfile=${truncated_file} testimg.ppm"
invCmd "pamrecolor --rmult=0.2989 --gmult=0.5866 testimg.ppm"

rm ${base_pgm} ${truncated_file}