diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2023-06-28 17:29:32 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2023-06-28 17:29:32 +0000 |
commit | 23ce26f64c34e30951ad9ade2151552ed77e7357 (patch) | |
tree | d73b31a0c2f7c7be4a69f8a8e84e00dd39c432b5 /test/rawtoppm.test | |
parent | 1b6e51a266008348ad93ed8b6ac9ec91b5024fea (diff) | |
download | netpbm-mirror-23ce26f64c34e30951ad9ade2151552ed77e7357.tar.gz netpbm-mirror-23ce26f64c34e30951ad9ade2151552ed77e7357.tar.xz netpbm-mirror-23ce26f64c34e30951ad9ade2151552ed77e7357.zip |
promote Advanced to Stable
git-svn-id: http://svn.code.sf.net/p/netpbm/code/stable@4558 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'test/rawtoppm.test')
-rwxr-xr-x | test/rawtoppm.test | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/test/rawtoppm.test b/test/rawtoppm.test new file mode 100755 index 00000000..3c309259 --- /dev/null +++ b/test/rawtoppm.test @@ -0,0 +1,72 @@ +#! /bin/bash +# This script tests: rawtoppm +# Also requires: pamcut ppmtorgb3 rgb3toppm ppmtoppm + +# Test 1 + +echo "Test 1: should print '0 0 : 0'" + +rawtoppm -headerskip 15 227 149 testimg.ppm | cmp -s - testimg.ppm + echo ${PIPESTATUS[@]} ":" $? + +# Test 2 +echo "Test 2: should print '0 0 : 0' five times" + +tmpdir=${tmpdir:-/tmp} +test0_ppm=${tmpdir}/test0.ppm + +for i in 0 1 10 99 220 + do + pamcut -cropright $i testimg.ppm > ${test0_ppm} + rawtoppm -headerskip 15 -rowskip $((i * 3)) $((227 - i)) 149 testimg.ppm | \ + cmp -s ${test0_ppm} - + echo ${PIPESTATUS[@]} ":" $? + done + +rm ${test0_ppm} + + +# Test 3 +echo "Test 3: should print '0 0 0 : 0' five times" + +ppmtorgb3 testimg.ppm + +rgb3toppm testimg.red testimg.blu testimg.grn | \ + rawtoppm -headerskip 15 -rbg 227 149 | cmp -s - testimg.ppm + echo ${PIPESTATUS[@]} ":" $? + +rgb3toppm testimg.grn testimg.red testimg.blu | \ + rawtoppm -headerskip 15 -grb 227 149 | cmp -s - testimg.ppm + echo ${PIPESTATUS[@]} ":" $? + +rgb3toppm testimg.grn testimg.blu testimg.red | \ + rawtoppm -headerskip 15 -gbr 227 149 | cmp -s - testimg.ppm + echo ${PIPESTATUS[@]} ":" $? + +rgb3toppm testimg.blu testimg.red testimg.grn | \ + rawtoppm -headerskip 15 -brg 227 149 | cmp -s - testimg.ppm + echo ${PIPESTATUS[@]} ":" $? + +rgb3toppm testimg.blu testimg.grn testimg.red | \ + rawtoppm -headerskip 15 -bgr 227 149 | cmp -s - testimg.ppm + echo ${PIPESTATUS[@]} ":" $? + +# Test 4 +echo "Test 4" + +test1_ppm=${tmpdir}/test1.ppm + +cat <<EOF > ${test1_ppm} +P3 +5 5 +9 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 5 5 5 5 5 9 9 9 9 9 +0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 +0 1 2 3 4 1 2 3 4 5 2 3 4 5 6 +9 8 7 6 5 4 3 2 1 0 0 0 0 0 0 +EOF + +ppmtoppm < ${test1_ppm} | rawtoppm -headerskip 9 5 5 -plain + +rm ${test1_ppm} testimg.red testimg.grn testimg.blu |