about summary refs log tree commit diff
path: root/test/pnmcrop-blank.test
blob: bb26bdc04f350ff4ce131de63aa40dcfaa165b15 (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
#! /bin/sh
# This script tests: pnmcrop
# Also requires: pbmmake ppmmake

tmpdir=${tmpdir:-/tmp}

test_pbm=${tmpdir}/test.pbm
test_ppm=${tmpdir}/test.ppm

echo "Error messages should appear below the line." 1>&2
echo "--------------------------------------------" 1>&2

#Test 1
echo Test 1

( pbmmake -white 15 14; pbmmake -gray 15 14; pbmmake -black 15 14 ) > \
  ${test_pbm}
for type in    "-blank-image=pass" \
               "-blank-image=minimize" \
               "-blank-image=minimize -top" \
               "-blank-image=minimize -bottom" \
               "-blank-image=minimize -left" \
               "-blank-image=minimize -right" \
               "-blank-image=minimize -left -right" \
               "-blank-image=maxcrop" \
               "-blank-image=abort" ""
  do
  echo ${type}
  pnmcrop -reportsize ${type} ${test_pbm} || echo "fail1"
  pnmcrop -reportsize ${type} -white ${test_pbm} || echo "fail2"
  pnmcrop -reportsize ${type} -black ${test_pbm} || echo "fail3"
  done

rm ${test_pbm}


#Test 2

ppmmake rgb:ff/ff/ff 100 99 > ${test_ppm}
echo Test 2
for type in    "-blank-image=maxcrop -top" \
               "-blank-image=minimize" "-blank-image=maxcrop" \
               "-blank-image=maxcrop -top" \
               "-blank-image=maxcrop -bottom" \
               "-blank-image=maxcrop -left" \
               "-blank-image=maxcrop -right" \
               "-blank-image=maxcrop -top -bottom -right" ""
  do
  echo ${type}
  pnmcrop -reportsize ${type} ${test_ppm} || echo "fail4"
  pnmcrop -reportsize ${type} -white ${test_ppm} || echo "fail5"
  pnmcrop -reportsize ${type} -black ${test_ppm} || echo "fail6"
  done

rm ${test_ppm}