diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2020-03-26 02:53:02 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2020-03-26 02:53:02 +0000 |
commit | b117a415aaf58c435805243a930e833f8cf62421 (patch) | |
tree | ca6cda4c24d37737a3942e534b95006bcd566c5a /test/pamcut.test | |
parent | 34bb24c566c9d9fe3c4ae71fc4c6b53323fb1dd9 (diff) | |
download | netpbm-mirror-b117a415aaf58c435805243a930e833f8cf62421.tar.gz netpbm-mirror-b117a415aaf58c435805243a930e833f8cf62421.tar.xz netpbm-mirror-b117a415aaf58c435805243a930e833f8cf62421.zip |
Promote trunk (10.90.00) to advanced
git-svn-id: http://svn.code.sf.net/p/netpbm/code/advanced@3784 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'test/pamcut.test')
-rwxr-xr-x | test/pamcut.test | 66 |
1 files changed, 64 insertions, 2 deletions
diff --git a/test/pamcut.test b/test/pamcut.test index 9971b1a5..e4d8c62f 100755 --- a/test/pamcut.test +++ b/test/pamcut.test @@ -31,7 +31,7 @@ pamcut -top 10 -left 10 -bottom -11 -right -11 testimg.ppm | cksum pamcut -top 10 -left 10 -width 207 -height 129 testimg.ppm | cksum -# Test 5. Should print 2425386270 41 four times +# Test 5. Should print 2425386270 41 five times echo Test 5. pamcut -croptop 0 -cropleft 0 -cropbottom 0 -cropright 0 testgrid.pbm | \ @@ -39,9 +39,71 @@ pamcut -croptop 0 -cropleft 0 -cropbottom 0 -cropright 0 testgrid.pbm | \ pamcut -top 0 -left 0 -bottom 15 -right 13 testgrid.pbm | cksum pamcut -top 0 -left 0 -bottom -1 -right -1 testgrid.pbm | cksum pamcut -top 0 -left 0 -width 14 -height 16 testgrid.pbm | cksum - +pamcut testgrid.pbm | cksum # Test 6. Should print 3412257956 129 echo Test 6. pbmmake -g 50 50 | pamcut 5 5 30 30 | cksum + + +echo "Test Invalid" + +tmpdir=${tmpdir:-/tmp} +test_out=${tmpdir}/test_out + +echo 1>&2 +echo "Invalid command-line argument combinations." 1>&2 +echo "Error messages should appear below the line." 1>&2 +echo "-----------------------------------------------------------" 1>&2 + +# overspecification +pamcut -left=1 -right=1 -width=14 testgrid.pbm > ${test_out} || \ + echo -n "Expected failure 1"; test -s ${test_out}; echo " "$? + +pamcut -top=1 -bottom=1 -height=16 testgrid.pbm > ${test_out} || \ + echo -n "Expected failure 2"; test -s ${test_out}; echo " "$? + +pamcut -right=1 -cropright=1 testgrid.pbm > ${test_out} || \ + echo -n "Expected failure 3"; test -s ${test_out}; echo " "$? + +pamcut -top=1 -croptop=1 testgrid.pbm > ${test_out} || \ + echo -n "Expected failure 4"; test -s ${test_out}; echo " "$? + +pamcut -bottom=1 -cropbottom=1 testgrid.pbm > ${test_out} || \ + echo -n "Expected failure 5"; test -s ${test_out}; echo " "$? + +pamcut -left=1 -cropleft=1 testgrid.pbm > ${test_out} || \ + echo -n "Expected failure 6"; test -s ${test_out}; echo " "$? + +# excessive cropping +pamcut -cropleft=7 -cropright=8 testgrid.pbm > ${test_out} || \ + echo -n "Expected failure 7"; test -s ${test_out}; echo " "$? + +pamcut -left=7 -right=6 testgrid.pbm > ${test_out} || \ + echo -n "Expected failure 8"; test -s ${test_out}; echo " "$? + +pamcut -croptop=8 -cropbottom=8 testgrid.pbm > ${test_out} || \ + echo -n "Expected failure 9"; test -s ${test_out}; echo " "$? + +pamcut -top=10 -bottom=9 testgrid.pbm > ${test_out} || \ + echo -n "Expected failure 6"; test -s ${test_out}; echo " "$? + +# pad absent +pamcut -cropleft=1 -width=14 testgrid.pbm > ${test_out} || \ + echo -n "Expected failure 10"; test -s ${test_out}; echo " "$? + +pamcut -croptop=1 -height=16 testgrid.pbm > ${test_out} || \ + echo -n "Expected failure 11"; test -s ${test_out}; echo " "$? + +# legacy style: insufficient number of positional parameters +pamcut 5 testimg.ppm > ${test_out} || \ + echo -n "Expected failure 12"; test -s ${test_out}; echo " "$? + +pamcut 5 4 testimg.ppm > ${test_out} || \ + echo -n "Expected failure 13"; test -s ${test_out}; echo " "$? + +pamcut 5 5 30 testimg.ppm > ${test_out} || \ + echo -n "Expected failure 14"; test -s ${test_out}; echo " "$? + +rm -f ${test_out} \ No newline at end of file |