diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2023-09-16 22:57:46 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2023-09-16 22:57:46 +0000 |
commit | 31b2f7ca49f576a9b7a5fe6b0cfed343c82d9d09 (patch) | |
tree | 38170a0a9e6f2e19b369c5f98d1f8ed4077b95ae /test | |
parent | 1c49469266e75bd8f11cec532758ce22bd81d66d (diff) | |
download | netpbm-mirror-31b2f7ca49f576a9b7a5fe6b0cfed343c82d9d09.tar.gz netpbm-mirror-31b2f7ca49f576a9b7a5fe6b0cfed343c82d9d09.tar.xz netpbm-mirror-31b2f7ca49f576a9b7a5fe6b0cfed343c82d9d09.zip |
test updates; move some tests from other directories to test directory, improve ppmrough, xwd-roundtrip
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4663 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'test')
-rw-r--r-- | test/Test-Order | 6 | ||||
-rwxr-xr-x | test/pamstereogram.ok | 32 | ||||
-rwxr-xr-x | test/pamstereogram.test | 80 | ||||
-rwxr-xr-x | test/pamtosvg.ok | 4 | ||||
-rwxr-xr-x | test/pamtosvg.test | 45 | ||||
-rwxr-xr-x | test/ppmrough.ok | 23 | ||||
-rwxr-xr-x | test/ppmrough.test | 46 | ||||
-rwxr-xr-x | test/ppmtomitsu.ok | 14 | ||||
-rwxr-xr-x | test/ppmtomitsu.test | 31 | ||||
-rw-r--r-- | test/xwd-roundtrip.ok | 7 | ||||
-rwxr-xr-x | test/xwd-roundtrip.test | 17 |
11 files changed, 296 insertions, 9 deletions
diff --git a/test/Test-Order b/test/Test-Order index 7bec1002..63a071d9 100644 --- a/test/Test-Order +++ b/test/Test-Order @@ -27,6 +27,8 @@ pamcrater.test ppmpat.test ppmforge-parameters.test +pamstereogram.test + # Generators with random components pbmnoise1.test @@ -137,6 +139,8 @@ pammixmulti-identity.test pamaddnoise-parameters.test +pamstack.test + # Symmetry test symmetry.test @@ -161,8 +165,10 @@ pbm-misc-converters.test # Format converter tests pamtopdbimg.test +pamtosvg.test pbmtog3.test ppmtoapplevol.test +ppmtomitsu.test 411toppm.test eyuvtoppm.test rawtoppm.test diff --git a/test/pamstereogram.ok b/test/pamstereogram.ok new file mode 100755 index 00000000..265a4fc5 --- /dev/null +++ b/test/pamstereogram.ok @@ -0,0 +1,32 @@ +Test 00. Should print 729348909 237 +729348909 237 +Test 01. Should print 3308667841 293 +3308667841 293 +Test 02. Should print 3308667841 293 +3308667841 293 +Test 03. Should print 748200469 170 +748200469 170 +Test 04. Should print 1538641408 1070 +1538641408 1070 +Test 10. Should print 1266273778 293 +1266273778 293 +Test 11. Should print 55276708 1070 +55276708 1070 +Test 20. Should print 1920539795 289 +1920539795 289 +Test 21. Should print 4069109690 4068 +4069109690 4068 +Test 22. Should print 1163376052 4068 +1163376052 4068 +Test 30. Should print 2127252909 731 +2127252909 731 +Test 31. Should print 858421050 12062 +858421050 12062 +Test 40. Should print 1236679620 660 +1236679620 660 +Test 41. Should print 1022068930 5014 +1022068930 5014 +Test 51. Should print 3784833098 11071 +3784833098 11071 +Test 52. Should print 1419662425 1441 +1419662425 1441 diff --git a/test/pamstereogram.test b/test/pamstereogram.test new file mode 100755 index 00000000..02da9724 --- /dev/null +++ b/test/pamstereogram.test @@ -0,0 +1,80 @@ +#! /bin/sh +# This script tests: pamstereogram +# Also requires: pamdepth + +tmpdir=${tmpdir:-/tmp} +testgrid_pgm=${tmpdir}/testgrid.pgm + +# Make input file + +echo "Test 00. Should print 729348909 237" +pamdepth -quiet 255 testgrid.pbm | tee ${testgrid_pgm} | cksum + + +# Random pattern + +echo "Test 01. Should print 3308667841 293" +pamstereogram -randomseed=1 testgrid.pbm | cksum +echo "Test 02. Should print 3308667841 293" +pamstereogram -randomseed=1 -blackandwhite testgrid.pbm | cksum +echo "Test 03. Should print 748200469 170" +pamseq -tupletype=GRAYSCALE 1 100 | pamstereogram -randomseed=1 | cksum +echo "Test 04. Should print 1538641408 1070" +pamgauss 100 10 -maxval=10000 -sigma 20 | pamfunc -multiplier=500 | \ + pamstereogram -randomseed=1 -dpi=10 | cksum + +# Makemask + +echo "Test 10. Should print 1266273778 293" +pamstereogram -randomseed=1 -makemask testgrid.pbm | cksum + +echo "Test 11. Should print 55276708 1070" +pamgauss 100 10 -maxval=10000 -sigma 20 | pamfunc -multiplier=500 | \ + pamstereogram -randomseed=1 -dpi=10 -makemask | cksum + +# Grayscale + +echo "Test 20. Should print 1920539795 289" +pamstereogram -randomseed=1 -grayscale testgrid.pbm | cksum +echo "Test 21. Should print 4069109690 4068" +pamseq 1 100 | pnmtile 200 20 | \ + pamstereogram -randomseed=1 -dpi=10 -grayscale | \ + cksum +echo "Test 22. Should print 1163376052 4068" +pamseq 1 100 | pnmtile 200 20 | \ + pamstereogram -randomseed=1 -dpi=10 -grayscale -maxval 255 | \ + cksum + +# Color + +echo "Test 30. Should print 2127252909 731" +pamstereogram -randomseed=1 -color testgrid.pbm | cksum +echo "Test 31. Should print 858421050 12062" +pamseq 1 100 | pnmtile 200 20 | \ + pamstereogram -randomseed=1 -dpi=10 -color | \ + cksum + +# Pattern file + +echo "Test 40. Should print 1236679620 660" +pamgradient black gray50 white gray50 100 50 | \ + pamstereogram -patfile testgrid.pbm -eyesep=.1 -crosseyed | cksum + +echo "Test 41. Should print 1022068930 5014" +pamgradient black gray50 white gray50 100 50 | \ + pamstereogram -patfile ${testgrid_pgm} -eyesep=.1 -crosseyed | cksum + +# drawguides + +echo "Test 51. Should print 3784833098 11071" +pamgradient black gray50 white gray50 100 50 | \ + pamstereogram -randomseed=1 -dpi 10 -guidesize=20 -guidetop | cksum + +echo "Test 52. Should print 1419662425 1441" +pamgradient black gray50 white gray50 100 50 | \ + pamstereogram -patfile=testgrid.pbm -dpi 10 -guidesize=20 -guidetop | cksum + + +# Clean up files we created +rm ${testgrid_pgm} + diff --git a/test/pamtosvg.ok b/test/pamtosvg.ok new file mode 100755 index 00000000..918555e0 --- /dev/null +++ b/test/pamtosvg.ok @@ -0,0 +1,4 @@ +Test 1. Should print match +match +Test 2. Should print match +match diff --git a/test/pamtosvg.test b/test/pamtosvg.test new file mode 100755 index 00000000..332040ea --- /dev/null +++ b/test/pamtosvg.test @@ -0,0 +1,45 @@ +#! /bin/sh +# This script tests: pamtosvg +# Also requires: ppmmake ppmdraw + +tmpdir=${tmpdir:-/tmp} +testline_svg=${tmpdir}/testline.svg +testgrid_svg=${tmpdir}/testgrid.svg + +cat > ${testline_svg} << EOF +<?xml version="1.0" standalone="yes"?> +<svg width="20" height="20"> +<path style="fill:#000000; stroke:none;" d="M0 0L0 20L20 20L20 0L0 0z"/> +<path style="fill:#ffffff; stroke:none;" d="M5 2L15 18L16 18L5 2z"/> +</svg> +EOF + +echo "Test 1. Should print match" + +ppmmake black 20 20 | ppmdraw -script="line 5 2 15 17" | pamtosvg |\ + cmp -s ${testline_svg} - && echo "match" || echo "no match" +rm ${testline_svg} + +cat > ${testgrid_svg} << EOF +<?xml version="1.0" standalone="yes"?> +<svg width="14" height="16"> +<path style="fill:#000000; stroke:none;" d="M0 0L0 16L14 16L14 1L13 0L0 0z"/> +<path style="fill:#ffffff; stroke:none;" d="M1 0L2 1L1 0M3 0L4 1L3 0M5 0L6 \ +1L5 0M7 0L8 1L7 0M9 0L10 1L9 0M11 0L12 1L11 0M13 0L14 1L13 0M1 2L2 3L1 2M3 \ +2L4 3L3 2M5 2L6 3L5 2M7 2L8 3L7 2M9 2L10 3L9 2M11 2L12 3L11 2M13 2L14 3L13 \ +2M1 4L2 5L1 4M3 4L4 5L3 4M5 4L6 5L5 4M7 4L8 5L7 4M9 4L10 5L9 4M11 4L12 5L11 \ +4M13 4L14 5L13 4M1 6L2 7L1 6M3 6L4 7L3 6M5 6L6 7L5 6M7 6L8 7L7 6M9 6L10 7L9 \ +6M11 6L12 7L11 6M13 6L14 7L13 6M1 8L2 9L1 8M3 8L4 9L3 8M5 8L6 9L5 8M7 8L8 9L7 \ +8M9 8L10 9L9 8M11 8L12 9L11 8M13 8L14 9L13 8M1 10L2 11L1 10M3 10L4 11L3 10M5 \ +10L6 11L5 10M7 10L8 11L7 10M9 10L10 11L9 10M11 10L12 11L11 10M13 10L14 11L13 \ +10M1 12L2 13L1 12M3 12L4 13L3 12M5 12L6 13L5 12M7 12L8 13L7 12M9 12L10 13L9 \ +12M11 12L12 13L11 12M13 12L14 13L13 12M1 14L2 15L1 14M3 14L4 15L3 14M5 14L6 \ +15L5 14M7 14L8 15L7 14M9 14L10 15L9 14M11 14L12 15L11 14M13 14L14 15L13 14z"/> +</svg> +EOF + +echo "Test 2. Should print match" + +pamtosvg testgrid.pbm | tee /tmp/a2 |\ + cmp -s ${testgrid_svg} - && echo "match" || echo "no match" +rm ${testgrid_svg} diff --git a/test/ppmrough.ok b/test/ppmrough.ok index 83643849..4beff006 100755 --- a/test/ppmrough.ok +++ b/test/ppmrough.ok @@ -1 +1,24 @@ +Test 1. Should print 378403602 30015 378403602 30015 +Test 2. Should print 378403602 30015 +378403602 30015 +Test 3. Should print 535171440 30015 +535171440 30015 +Test 4. Should print 937167683 30015 +937167683 30015 +Test 5. Should print 1927474861 30015 +1927474861 30015 +Test 6. Should print 3596045345 30015 +3596045345 30015 +Test 7. Should print 198510149 30015 +198510149 30015 +Test 8. Should print 1128371780 30015 +1128371780 30015 +Test 9. Should print 2909877411 30015 +2909877411 30015 +Test 10. Should print 2820370592 30015 +2820370592 30015 +Test 11. Should print 2028409204 30015 +2028409204 30015 +Test 12. Should print 4234304830 30015 +4234304830 30015 diff --git a/test/ppmrough.test b/test/ppmrough.test index b10ba941..e1d720d5 100755 --- a/test/ppmrough.test +++ b/test/ppmrough.test @@ -2,5 +2,47 @@ # This script tests: ppmrough # Also requires: -# Should print: 378403602 30015 (Glibc and MAC OS) -ppmrough -randomseed 1 | cksum +defaultopts="-randomseed 1 -bg rgb:00/ff/ff -fg rgb:ff/ff/00 -w 100 -h 100" + +# No border + +echo "Test 1. Should print 378403602 30015" +ppmrough -randomseed 1 | cksum + +echo "Test 2. Should print 378403602 30015" +ppmrough -randomseed 1 -var 0 | cksum + +# Vertical border + +echo "Test 3. Should print 535171440 30015" +ppmrough ${defaultopts} -left 20 | cksum + +echo "Test 4. Should print 937167683 30015" +ppmrough ${defaultopts} -right 20 | cksum + +echo "Test 5. Should print 1927474861 30015" +ppmrough ${defaultopts} -left 50 | cksum + +echo "Test 6. Should print 3596045345 30015" +ppmrough ${defaultopts} -right 50 | cksum + +echo "Test 7. Should print 198510149 30015" +ppmrough ${defaultopts} -right 20 -var 0 | cksum + +# Horizontal border + +echo "Test 8. Should print 1128371780 30015" +ppmrough ${defaultopts} -top 30 | cksum + +echo "Test 9. Should print 2909877411 30015" +ppmrough ${defaultopts} -bottom 25 | cksum + +echo "Test 10. Should print 2820370592 30015" +ppmrough ${defaultopts} -top 50 | cksum + +echo "Test 11. Should print 2028409204 30015" +ppmrough ${defaultopts} -bottom 50 | cksum + +echo "Test 12. Should print 4234304830 30015" +ppmrough ${defaultopts} -bottom 10 -var 0 | cksum + diff --git a/test/ppmtomitsu.ok b/test/ppmtomitsu.ok new file mode 100755 index 00000000..951189d4 --- /dev/null +++ b/test/ppmtomitsu.ok @@ -0,0 +1,14 @@ +Test 0. Should print 458455366 101484 +458455366 101484 +Test 1. Should print 3110813682 101562 +3110813682 101562 +Test 2. Should print 4168174994 34399 +4168174994 34399 +Test 3. Should print 3201293405 310 +3201293405 310 +Test 4. Should print 3354679572 752 +3354679572 752 +Test 5. Should print 3999654426 101549 +3999654426 101549 +Test 6. Should print 4201246884 101549 +4201246884 101549 diff --git a/test/ppmtomitsu.test b/test/ppmtomitsu.test new file mode 100755 index 00000000..ce4bbf56 --- /dev/null +++ b/test/ppmtomitsu.test @@ -0,0 +1,31 @@ +#! /bin/sh +# This script tests: ppmtomitsu +# Also requires: pnmcolormap pnmremap + +tmpdir=${tmpdir:-/tmp} +testimg100_ppm=${tmpdir}/testimg100.ppm + +echo "Test 0. Should print 458455366 101484" +# equivalent to: Pnmquant 100 testimg.ppm +pnmcolormap 100 testimg.ppm | pnmremap -nofloyd -mapfile=- testimg.ppm |\ + tee ${testimg100_ppm} | cksum + +echo "Test 1. Should print 3110813682 101562" +ppmtomitsu testimg.ppm | cksum + +echo "Test 2. Should print 4168174994 34399" +ppmtomitsu ${testimg100_ppm} | cksum + +echo "Test 3. Should print 3201293405 310" +ppmtomitsu testgrid.pbm | cksum + +echo "Test 4. Should print 3354679572 752" +ppmtomitsu -tiny testgrid.pbm | cksum + +echo "Test 5. Should print 3999654426 101549" +ppmtomitsu -tiny testimg.ppm | cksum + +echo "Test 6. Should print 4201246884 101549" +ppmtomitsu -tiny ${testimg100_ppm} | cksum + +rm ${testimg100_ppm} diff --git a/test/xwd-roundtrip.ok b/test/xwd-roundtrip.ok index 864d737a..31dcba3e 100644 --- a/test/xwd-roundtrip.ok +++ b/test/xwd-roundtrip.ok @@ -1,6 +1,9 @@ -Test 1. Should produce 1571496937 33838, cksum of testimg.red +Test 1. Should produce 1571496937 33838, cksum of testimg.red twice +1571496937 33838 1571496937 33838 Test 2. Should produce 1926073387 101484 1926073387 101484 -Test 3. Should produce 281226646 481 +Test 3. Should produce 281226646 481 three times +281226646 481 +281226646 481 281226646 481 diff --git a/test/xwd-roundtrip.test b/test/xwd-roundtrip.test index 2d00971d..1583cd68 100755 --- a/test/xwd-roundtrip.test +++ b/test/xwd-roundtrip.test @@ -1,15 +1,22 @@ #! /bin/sh # This script tests: pnmtoxwd xwdtopnm -# Also requires: pamchannel pamtopnm pamdepth +# Also requires: pamchannel pamtopnm pamdepth ppmtopgm -echo "Test 1. Should produce 1571496937 33838, cksum of testimg.red" +echo "Test 1. Should produce 1571496937 33838, cksum of testimg.red twice" pamchannel -infile=testimg.ppm -tupletype="GRAYSCALE" 0 | pamtopnm | \ pnmtoxwd | xwdtopnm | pamdepth 255 | cksum +pamchannel -infile=testimg.ppm -tupletype="GRAYSCALE" 0 | pamtopnm | \ + pnmtoxwd -direct | xwdtopnm -quiet | pamdepth 255 | ppmtopgm | cksum + echo "Test 2. Should produce 1926073387 101484" pnmtoxwd --quiet testimg.ppm | \ xwdtopnm --quiet | pamdepth 255 | cksum -echo "Test 3. Should produce 281226646 481" -pnmtoxwd --quiet maze.pbm | \ - xwdtopnm | cksum +echo "Test 3. Should produce 281226646 481 three times" +pnmtoxwd --quiet maze.pbm | xwdtopnm | cksum + +pnmtoxwd --quiet -pseudodepth 1 maze.pbm | xwdtopnm | cksum + +pnmtoxwd --quiet -pseudodepth 16 maze.pbm | xwdtopnm | cksum + |