about summary refs log tree commit diff
path: root/test/pambackground.test
blob: 58526fdddece989d58c14b1779f25763ce3b4a1b (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
#! /bin/bash
# This script tests: pambackground 
# Also requires: pamgradient pamseq pbmmake pnmmargin pnmremap pnmtile

  alias pambackground="${PBM_TESTPREFIX}pambackground"
  alias pamgradient="${PBM_BINPREFIX}pamgradient"
  alias pamseq="${PBM_BINPREFIX}pamseq"
  alias pbmmake="${PBM_BINPREFIX}pbmmake"
  alias pnmmargin="${PBM_BINPREFIX}pnmmargin"
  alias pnmremap="${PBM_BINPREFIX}pnmremap"
  alias pnmtile="${PBM_BINPREFIX}pnmtile"
  shopt -s expand_aliases

tmpdir=${tmpdir:-/tmp}

# Test 1.
# Should produce: 2155020792 451
pbmmake -g 23 11 | pnmmargin -black 2 | pambackground | cksum


# Test 2.
# Should produce: 2514682516 33871
ibmttl_pam=${tmpdir}/ibmttl.pam

pamseq 3 1 > ${ibmttl_pam} && \
pnmremap -quiet -mapfile ${ibmttl_pam} testimg.ppm | pambackground | cksum
rm ${ibmttl_pam}


# Test 3.
# Should produce: 2667595257 17328
pamgradient rgb:01/01/01 rgb:ff/7f/00 rgb:00/ff/7f rgb:fe/fe/fe 10 10 | \
pnmmargin -white 2 | pnmtile 144 120 | pambackground | cksum


# pamgradient rgb:01/01/01 rgb:ff/7f/00  rgb:00/ff/7f rgb:fe/fe/fe 10 10 | \
# pnmmargin -white 2 | pnmtile 144 120 | cksum
# should produce: 3147800256 51855
# Above input image is a "wall" with 12x10 "windows".

# pnmremap -mapfile ${ibmttl_pam} testimg.ppm | cksum
# should produce : 452672747 101517