about summary refs log tree commit diff
path: root/test/pbmtextps.test
blob: 975f960cb8139572c3049081ef9e4ce76c2f99f3 (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
#! /bin/sh
# This script tests: pbmtextps pbmminkowski
# Also requires: gs pnmcrop

tmpdir=${tmpdir:-/tmp}
text_pbm=${tmpdir}/text.pbm

text="Do one thing and do it well."

echo "Test 1.  Should print 0 five times."
# -ascent -descent values too small to have effect

pbmtextps -descent=1 ${text} > ${text_pbm}
  echo $?
  test -s ${text_pbm}
  echo $?
pbmtextps -ascent=10 -descent=1 ${text} | cmp -s - ${text_pbm}
  echo $?
pbmtextps -ascent=1 -descent=1 ${text}  | cmp -s - ${text_pbm}
  echo $?
pbmtextps -descent=2 ${text} | cmp -s - ${text_pbm}
  echo $?

rm ${text_pbm}


echo "Test 2.  Should print P1 1 1 0 three times"
# blank images

pbmtextps " " | pnmcrop -plain -blank-image=minimize |\
  tr '\n' ' ' ; echo
pbmtextps -fontsize=12   " " | pnmcrop -plain -blank-image=minimize |\
  tr '\n' ' ' ; echo
pbmtextps -resolution=50 " " | pnmcrop -plain -blank-image=minimize |\
  tr '\n' ' ' ; echo 



echo "Test 3.  Should print eulerchi: N"
# Test with characters known to produce stable eulerchi values
# accross various fonts

pbmtextps " " | pbmminkowski | grep "eulerchi"

pbmtextps "+" | pbmminkowski | grep "eulerchi"

pbmtextps "+" | pnmcrop -left -right | pbmminkowski | grep "eulerchi"

pbmtextps "+" | pnmcrop | pbmminkowski | grep "eulerchi"

pbmtextps "o" | pnmcrop | pbmminkowski | grep "eulerchi"