diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2014-02-02 01:48:57 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2014-02-02 01:48:57 +0000 |
commit | 2f0b278d8156fb9c829f1ac97db5b8f2aab58717 (patch) | |
tree | 2bbc810809a84ca46758859ab167e060b3f6d7bc /test/pamslice-roundtrip.test | |
parent | babc41a25094d444c75c6345a3958d16293f85c1 (diff) | |
download | netpbm-mirror-2f0b278d8156fb9c829f1ac97db5b8f2aab58717.tar.gz netpbm-mirror-2f0b278d8156fb9c829f1ac97db5b8f2aab58717.tar.xz netpbm-mirror-2f0b278d8156fb9c829f1ac97db5b8f2aab58717.zip |
Add ability to run tests for a specific program; add ability to print messages when tests fail; new tests
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@2119 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'test/pamslice-roundtrip.test')
-rwxr-xr-x | test/pamslice-roundtrip.test | 59 |
1 files changed, 49 insertions, 10 deletions
diff --git a/test/pamslice-roundtrip.test b/test/pamslice-roundtrip.test index 5dc74d4d..edec0d26 100755 --- a/test/pamslice-roundtrip.test +++ b/test/pamslice-roundtrip.test @@ -1,11 +1,15 @@ #! /bin/bash -# This script tests: pamslice -# Also requires: pnmtopnm pamtopnm +# This script tests: pamslice pamdeinterlace +# Also requires: pamcut pnmtopnm pamflip alias pamslice="${PBM_TESTPREFIX}pamslice" + alias pamdeinterlace="${PBM_TESTPREFIX}pamdeinterlace" + alias pamcut="${PBM_BINPREFIX}pamcut" alias pnmtopnm="${PBM_BINPREFIX}pnmtopnm" + alias pamflip="${PBM_BINPREFIX}pamflip" shopt -s expand_aliases +# Test 1. # Slice rows, one by one, out of testgrid.pbm. # Add header and reconstruct pbm image. # Note that in pamslice output 0 is white and 1 is black: opposite of PBM @@ -13,21 +17,56 @@ (echo "P1" echo "14 16" - seq 0 15 | while read i; + seq 0 15 | while read i; do pamslice -row=$i testgrid.pbm | \ - awk '{print $2}' | sed 'y/01/10/'; + awk '{print $2}' | sed 'y/01/10/'; done ) | pnmtopnm | cksum -# Slice rows, one by one, out of testimg.ppm. +# Test 2. +# Slice rows, one by one, out of ppm test image +# We take a part out of testimg.ppm with pamcut for processing the +# whole image takes much time. # Add header and reconstruct ppm image. -# Should print 1926073387 101484 +# Should print 914327477 4864 + +pamcut 50 50 49 33 testimg.ppm > ${tmpdir}/test4933.ppm (echo "P3" - echo "227 149" + echo "49 33" echo "255" - seq 0 148 | while read i; + seq 0 32 | while read i; do - pamslice -row=$i testimg.ppm | awk '{print $2, $3, $4}'; - done ) | pnmtopnm | cksum + pamslice -row=$i ${tmpdir}/test4933.ppm | awk '{print $2, $3, $4}'; + done ) | pnmtopnm | cksum + +# Same as above test 2, but take cols instead of rows. +# Should print 914327477 4864 + +(echo "P3" + echo "33 49" + echo "255" + seq 0 48 | while read i; + do + pamslice -col=$i ${tmpdir}/test4933.ppm | awk '{print $2, $3, $4}'; + done ) | pamflip -xy | cksum + +# Test 4. +# Divide input image into two with pamdeinterlace and recombine. + +pamdeinterlace -takeodd ${tmpdir}/test4933.ppm > ${tmpdir}/testodd.ppm +pamdeinterlace -takeeven ${tmpdir}/test4933.ppm > ${tmpdir}/testevn.ppm + +(echo "P3" + echo "49 33" + echo "255" + seq 0 15 | while read i; + do + pamslice -row=$i ${tmpdir}/testevn.ppm | awk '{print $2, $3, $4}'; + pamslice -row=$i ${tmpdir}/testodd.ppm | awk '{print $2, $3, $4}'; + done + pamslice -row=16 ${tmpdir}/testevn.ppm | awk '{print $2, $3, $4}'; + ) | pnmtopnm | tee /tmp/z | cksum + +rm ${tmpdir}/test4933.ppm ${tmpdir}/testodd.ppm ${tmpdir}/testevn.ppm |