Skip to content

Commit 56257e6

Browse files
author
giraffedata
committed
miscellaneous test updates
git-svn-id: https://svn.code.sf.net/p/netpbm/code/trunk@4383 9d0c8265-081b-0410-96cb-a4ca84ce46f8
1 parent dbf0662 commit 56257e6

14 files changed

+520
-3
lines changed

test/Execute-Tests

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ elif [ $VALGRIND_TESTS = "on" ]
186186

187187
for i in awk basename cat cksum cmp comm cp cut date dirname \
188188
egrep fgrep file grep gs head iconv ls mkdir mktemp perl \
189-
printf rm sed seq sh sort tee tr uniq wc \
189+
printf rm sed seq sh sort tail tee tr uniq wc \
190190
testrandom Available-Testprog
191191

192192
# Tell valgrind not to probe execution of the above programs.

test/Test-Order

+3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ pbmtext.test
1616
pbmtext-bdf.test
1717
pbmtext-iso88591.test
1818
pbmtext-utf8.test
19+
pbmtextps-dump.test
20+
pbmtextps.test
1921
pbmupc.test
2022
pgmramp.test
2123
pamgauss.test
@@ -232,6 +234,7 @@ pj-roundtrip.test
232234
ps-roundtrip.test
233235
ps-flate-roundtrip.test
234236
ps-alt-roundtrip.test
237+
qoi-roundtrip.test
235238
sgi-roundtrip.test
236239
sbig-roundtrip.test
237240
st4-roundtrip.test

test/all-in-place.ok

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ pamarith: ok
4141
pambackground: ok
4242
pambayer: ok
4343
pambrighten: ok
44+
pamcat: ok
4445
pamchannel: ok
4546
pamcomp: ok
4647
pamcrater: ok

test/all-in-place.test

+2-1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ ordinary_testprogs="\
8383
pambackground \
8484
pambayer \
8585
pambrighten \
86+
pamcat \
8687
pamchannel \
8788
pamcomp \
8889
pamcrater \
@@ -438,4 +439,4 @@ testExitStatus anytopnm 0 $?
438439
manweb --help > /dev/null
439440
testExitStatus manweb 0 $?
440441

441-
# We do not test vidtoppm.
442+
# We do not test vidtoppm.

test/pbmtextps-dump.ok

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
Test 1
2+
-font=ZQUEl8eS38RlsvEahHGNfnrbSswrcJKFwvlCdEttwcheuXvCN49MvWmndqj4
3+
< /FindFont {/Times-Roman findfont} def
4+
> /FindFont {/ZQUEl8eS38RlsvEahHGNfnrbSswrcJKFwvlCdEttwcheuXvCN49MvWmndqj4 findfont} def
5+
-fontsize 2000
6+
< /fontsize 24.000000 def
7+
> /fontsize 2000.000000 def
8+
< /descent 36.000000 def
9+
< /leftmargin 12.000000 def
10+
> /descent 3000.000000 def
11+
> /leftmargin 1000.000000 def
12+
-resolution 7200
13+
-leftmargin=15
14+
< /leftmargin 12.000000 def
15+
> /leftmargin 15.000000 def
16+
-rightmargin=20
17+
< /rightmargin 0.000000 def
18+
> /rightmargin 20.000000 def
19+
-topmargin=10
20+
< /topmargin 0.000000 def
21+
> /topmargin 10.000000 def
22+
-bottommargin=14
23+
< /descent 36.000000 def
24+
> /descent 0.000000 def
25+
< /bottommargin 0.000000 def
26+
> /bottommargin 14.000000 def
27+
-ascent=30
28+
< /ascent 0.000000 def
29+
> /ascent 30.000000 def
30+
-descent=20
31+
< /descent 36.000000 def
32+
> /descent 20.000000 def
33+
-pad
34+
< /descent 36.000000 def
35+
> /descent 0.000000 def
36+
< /pad false def
37+
> /pad true def
38+
-crop
39+
< /descent 36.000000 def
40+
< /leftmargin 12.000000 def
41+
> /descent 0.000000 def
42+
> /leftmargin 0.000000 def
43+
-stroke 1
44+
< /pensize -1.000000 def
45+
> /pensize 1.000000 def
46+
Test Invalid
47+
Expected failure 1 (-fontsize) 1
48+
Expected failure 2 (-fontsize 0) 1
49+
Expected failure 3 (-resolution) 1
50+
Expected failure 4 (-resolution=0) 1
51+
Expected failure 5 (-leftmargin) 1
52+
Expected failure 6 (-leftmargin -1) 1
53+
Expected failure 7 (-rightmargin) 1
54+
Expected failure 8 (-rightmargin -1) 1
55+
Expected failure 9 (-topmargin) 1
56+
Expected failure 10 (-topmargin -1) 1
57+
Expected failure 11 (-bottommargin) 1
58+
Expected failure 12 (-bottommargin -1) 1
59+
Expected failure 13 (-ascent) 1
60+
Expected failure 14 (-ascent -1) 1
61+
Expected failure 15 (-descent) 1
62+
Expected failure 16 (-descent -1) 1
63+
Expected failure 17 (-stroke=A) 1
64+
Expected failure 18 (-pad -crop) 1
65+
Expected failure 19 (-font="") 1

test/pbmtextps-dump.test

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
#! /bin/sh
2+
# This script tests: pbmtextps
3+
# Also requires:
4+
5+
# Dump several variants of the ps file and compare against default.
6+
# Ghostscript is not required.
7+
8+
tmpdir=${tmpdir:-/tmp}
9+
text_pbm=${tmpdir}/text.pbm
10+
text_ps=${tmpdir}/text.ps
11+
12+
text="UNIX Philosophy: Do one thing and do it well."
13+
14+
# Test 1:
15+
echo "Test 1"
16+
17+
pbmtextps -dump-ps ${text} > ${text_ps}
18+
19+
# Font name is random sequence of alphanumerical characters.
20+
# Should not match any real name.
21+
22+
for flag in \
23+
"-font=ZQUEl8eS38RlsvEahHGNfnrbSswrcJKFwvlCdEttwcheuXvCN49MvWmndqj4" \
24+
"-fontsize 2000" \
25+
"-resolution 7200" \
26+
"-leftmargin=15" \
27+
"-rightmargin=20" \
28+
"-topmargin=10" \
29+
"-bottommargin=14" \
30+
"-ascent=30" \
31+
"-descent=20" \
32+
"-pad" \
33+
"-crop" \
34+
"-stroke 1"
35+
do
36+
echo ${flag}
37+
pbmtextps -dump-ps ${flag} ${text} | diff ${text_ps} - | grep "^[<>]"
38+
done
39+
40+
rm ${text_ps}
41+
42+
43+
echo "Test Invalid"
44+
45+
echo 1>&2
46+
echo "Invalid command line arguments" 1>&2
47+
echo "Error messages should appear below the line." 1>&2
48+
echo "-----------------------------------------------------------" 1>&2
49+
50+
test_out=${tmpdir}/test.out
51+
52+
n=1
53+
54+
for error_flag in \
55+
"-fontsize" \
56+
"-fontsize 0" \
57+
"-resolution" \
58+
"-resolution=0" \
59+
"-leftmargin" \
60+
"-leftmargin -1" \
61+
"-rightmargin" \
62+
"-rightmargin -1" \
63+
"-topmargin" \
64+
"-topmargin -1" \
65+
"-bottommargin" \
66+
"-bottommargin -1" \
67+
"-ascent" \
68+
"-ascent -1" \
69+
"-descent" \
70+
"-descent -1" \
71+
"-stroke=A" \
72+
"-pad -crop"
73+
do
74+
pbmtextps ${error_flag} -dump-ps ${text} >${test_out} || \
75+
printf "Expected failure $n (${error_flag})";
76+
test -s ${test_out}; echo " "$?
77+
rm -f ${test_out}
78+
n=$((n + 1))
79+
done
80+
81+
pbmtextps -font="" -dump-ps ${text} >${test_out} || \
82+
printf "Expected failure $n (-font=\"\")";
83+
test -s ${test_out}; echo " "$?
84+
rm -f ${test_out}

test/pbmtextps.ok

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Test 1. Should print 0 five times.
2+
0
3+
0
4+
0
5+
0
6+
0
7+
Test 2. Should print P1 1 1 0 three times
8+
P1 1 1 0
9+
P1 1 1 0
10+
P1 1 1 0
11+
Test 3. Should print eulerchi: N
12+
eulerchi: 1
13+
eulerchi: 2
14+
eulerchi: 3
15+
eulerchi: 4
16+
eulerchi: 5

test/pbmtextps.test

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#! /bin/sh
2+
# This script tests: pbmtextps pbmminkowski
3+
# Also requires: gs pnmcrop
4+
5+
tmpdir=${tmpdir:-/tmp}
6+
text_pbm=${tmpdir}/text.pbm
7+
8+
text="Do one thing and do it well."
9+
10+
echo "Test 1. Should print 0 five times."
11+
# -ascent -descent values too small to have effect
12+
13+
pbmtextps -descent=1 ${text} > ${text_pbm}
14+
echo $?
15+
test -s ${text_pbm}
16+
echo $?
17+
pbmtextps -ascent=10 -descent=1 ${text} | cmp -s - ${text_pbm}
18+
echo $?
19+
pbmtextps -ascent=1 -descent=1 ${text} | cmp -s - ${text_pbm}
20+
echo $?
21+
pbmtextps -descent=2 ${text} | cmp -s - ${text_pbm}
22+
echo $?
23+
24+
rm ${text_pbm}
25+
26+
27+
echo "Test 2. Should print P1 1 1 0 three times"
28+
# blank images
29+
30+
pbmtextps " " | pnmcrop -plain -blank-image=minimize |\
31+
tr '\n' ' ' ; echo
32+
pbmtextps -fontsize=12 " " | pnmcrop -plain -blank-image=minimize |\
33+
tr '\n' ' ' ; echo
34+
pbmtextps -resolution=50 " " | pnmcrop -plain -blank-image=minimize |\
35+
tr '\n' ' ' ; echo
36+
37+
38+
39+
echo "Test 3. Should print eulerchi: N"
40+
# Test with characters known to produce stable eulerchi values
41+
# accross various fonts
42+
43+
pbmtextps " " | pbmminkowski | grep "eulerchi"
44+
45+
pbmtextps "+" | pbmminkowski | grep "eulerchi"
46+
47+
pbmtextps "+" | pnmcrop -left -right | pbmminkowski | grep "eulerchi"
48+
49+
pbmtextps "+" | pnmcrop | pbmminkowski | grep "eulerchi"
50+
51+
pbmtextps "o" | pnmcrop | pbmminkowski | grep "eulerchi"
52+
53+

test/qoi-roundtrip.ok

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
Test 1. Should print 1.N 0 0
2+
1.0 0 0
3+
1.1 0 0
4+
1.2 0 0
5+
1.3 0 0
6+
1.4 0 0
7+
Test 2. Should print 2.N 0 0
8+
2.0 0 0
9+
2.1 0 0
10+
2.2 0 0
11+
2.3 0 0
12+
2.4 0 0
13+
Test 3. Should print 3.N 0 0
14+
3.0 0 0
15+
3.1 0 0
16+
3.2 0 0
17+
3.3 0 0
18+
3.4 0 0
19+
Test Invalid
20+
Should print: Expected failure N 1
21+
Expected failure 1 1
22+
Expected failure 2 1
23+
Expected failure 3 1
24+
Expected failure 4 1
25+
Expected failure 5 1
26+
Expected failure 6 1
27+
Expected failure 7 1
28+
Expected failure 8 1
29+
------------------------------
30+
Should print: Expected failure N 0
31+
Expected failure 9 0
32+
Expected failure 10 0
33+
Expected failure 11 0
34+
Expected failure 12 0

0 commit comments

Comments
 (0)