Skip to content

Commit 0b75545

Browse files
author
giraffedata
committed
Add round-trip tests for 'xv', 'ppmtoarbtxt'; better cover compression scheme in macptoppm test
git-svn-id: https://svn.code.sf.net/p/netpbm/code/trunk@2464 9d0c8265-081b-0410-96cb-a4ca84ce46f8
1 parent 55668e2 commit 0b75545

8 files changed

+79
-7
lines changed

test/Test-Order

+2
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ pamslice-roundtrip.test
103103

104104
# Round-trip tests : lossless converters
105105

106+
ppmtoarbtxt-roundtrip.test
106107
atari-roundtrip.test
107108
atk-roundtrip.test
108109
avs-roundtrip.test
@@ -141,6 +142,7 @@ wbmp-roundtrip.test
141142
winicon-roundtrip.test
142143
xbm-roundtrip.test
143144
xpm-roundtrip.test
145+
xv-roundtrip.test
144146
xwd-roundtrip.test
145147

146148
# Round-trip tests : lossy converter

test/macp-roundtrip.ok

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
2425386270 41
2-
1005016577 51851
2+
2425386270 41
3+
2329957971 51851
4+
2907103393 5086
5+
2907103393 5086

test/macp-roundtrip.test

+26-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,31 @@
11
#! /bin/bash
22
# This script tests: pbmtomacp macptopbm
3-
# Also requires: pnmcrop pbmmake
3+
# Also requires: pnmcrop pbmpage pbmupc pnmpad
44

5+
tmpdir=${tmpdir:-/tmp}
6+
temp1_pbm=${tmpdir}/temp1.ppm
7+
temp2_pbm=${tmpdir}/temp2.ppm
58

6-
#Test 1. Should produce 2425386270 41
7-
pbmtomacp testgrid.pbm | macptopbm | pnmcrop | cksum
89

9-
#Test 2. Should produce 1005016577 51851
10-
pbmmake -g 576 720 | pbmtomacp | macptopbm | cksum
10+
# Test 1. Should produce 2425386270 41 twice
11+
# Because Macpaint files are fixed size (576 x 720 pixels)
12+
# pbmtomacp automatically adds padding when input is smaller.
13+
14+
pbmtomacp testgrid.pbm | macptopbm | tee ${temp1_pbm} | \
15+
pnmcrop | cksum
16+
17+
pbmtomacp ${temp1_pbm} | macptopbm | pnmcrop | cksum
18+
19+
20+
#Test 2. Should produce 2329957971 51851
21+
pbmpage 1 | pbmtomacp | macptopbm | cksum
22+
23+
24+
#Test 3. Should produce 2907103393 5086 twice
25+
pbmupc 0 12345 67890 | pnmpad -black -t 44 -b 20 -l 100 -r 251 | pbmtomacp | macptopbm | \
26+
tee ${temp2_pbm} | \
27+
pnmcrop | pnmcrop | cksum
28+
29+
pbmtomacp ${temp2_pbm} | macptopbm | pnmcrop | pnmcrop | cksum
30+
31+
rm ${temp1_pbm} ${temp2_pbm}

test/ppmdfont.test

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ ppmdmkfont | ppmddumpfont 2>&1 | cksum
99
# Test 2. Should produce: 2845495212 75033
1010
ppmdmkfont | ppmdcfont | cksum
1111

12-
# There is a strange glitch in output when ppmdcfont is compiled by clang:
12+
# There is a strange glitch in output when ppmdcfont is compiled by
13+
# clang version 3.2. Optimization (-O3) seems to be a factor.
14+
#
1315
# 3171,3173c3171,3173
1416
# < 0x01,
1517
# < 95,

test/ppmtoarbtxt-roundtrip.ok

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
1926073387 101484
2+
1926073387 101484

test/ppmtoarbtxt-roundtrip.test

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#! /bin/bash
2+
# This script tests: ppmtoarbtxt
3+
# Also requires: pnminvert pamtopnm
4+
5+
# Test. Invert colors.
6+
# Should print 1926073387 101484
7+
8+
tmpdir=${tmpdir:-/tmp}
9+
headskl=${tmpdir}/headskl
10+
bodyskl=${tmpdir}/bodyskl
11+
inv_ppm=${tmpdir}/inv.ppm
12+
13+
cat > ${headskl} << EOF
14+
P3
15+
#(width) #(height)
16+
255
17+
18+
EOF
19+
20+
cat > ${bodyskl} << EOF
21+
#(ired %d 255 0) #(igreen %d 255 0) #(iblue %d 255 0)
22+
23+
EOF
24+
25+
ppmtoarbtxt ${bodyskl} -hd ${headskl} testimg.ppm | tee ${inv_ppm} |
26+
pnminvert | cksum
27+
28+
29+
# Test 2.
30+
31+
cat ${inv_ppm} | ppmtoarbtxt ${bodyskl} -hd ${headskl} | pamtopnm | cksum
32+
33+
34+
rm ${bodyskl} ${headskl}

test/xv-roundtrip.ok

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2418728144 101484

test/xv-roundtrip.test

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#! /bin/bash
2+
# This script tests: pamtoxvmini xvminitoppm
3+
# Also requires: pamdepth
4+
5+
# Test. Should print 2418728144 101484
6+
7+
pamdepth 3 testimg.ppm | pamtoxvmini | xvminitoppm | cksum

0 commit comments

Comments
 (0)