diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2024-04-21 20:18:33 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2024-04-21 20:18:33 +0000 |
commit | 489686bcfff5a1fb66a049d0a6330f3eb5d67c4f (patch) | |
tree | 76503e0dceeebff6db9b5eb9aaeab0ea3bbf0fe5 | |
parent | 681afa5a0031823cc5107d9be323f20614f71870 (diff) | |
download | netpbm-mirror-489686bcfff5a1fb66a049d0a6330f3eb5d67c4f.tar.gz netpbm-mirror-489686bcfff5a1fb66a049d0a6330f3eb5d67c4f.tar.xz netpbm-mirror-489686bcfff5a1fb66a049d0a6330f3eb5d67c4f.zip |
missed in previous commit
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4910 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r-- | test/infotopam.ok | 27 | ||||
-rwxr-xr-x | test/infotopam.test | 65 | ||||
-rw-r--r-- | test/rgbt.txt | 16 |
3 files changed, 108 insertions, 0 deletions
diff --git a/test/infotopam.ok b/test/infotopam.ok new file mode 100644 index 00000000..03c029c7 --- /dev/null +++ b/test/infotopam.ok @@ -0,0 +1,27 @@ +Test 0.1 Should print 341768228 989 +341768228 989 +Test 0.2 Should print 3992125899 16230 +3992125899 16230 +Test 1.1 Should print 3375570914 10141 +3375570914 10141 +Test 1.2 Should print 1428271393 94509 +1428271393 94509 +Test 2. Should print 352521340 94509 +352521340 94509 +Test 3.1 Should print 3375570914 10141 +3375570914 10141 +Test 3.2 Should print 1428271393 94509 +1428271393 94509 +Test 4. Should print match twice +match +match +Test Invalid +Expected failure 1 (no output) +Expected failure 2 (no output) +Expected failure 3 (no output) +Expected failure 4 (no output) +Expected failure 5 (no output) +Expected failure 6 (no output) +Expected failure 7 (no output) +Expected failure 8 (no output) +Expected failure 9 (no output) diff --git a/test/infotopam.test b/test/infotopam.test new file mode 100755 index 00000000..5b849c65 --- /dev/null +++ b/test/infotopam.test @@ -0,0 +1,65 @@ +#! /bin/sh +# This script tests: infotopam +# Also requires: ppmchange pamtopnm + +tmpdir=${tmpdir:-/tmp} +test1_pam=${tmpdir}/test1.pam +test1ch_ppm=${tmpdir}/test1ch.ppm +RGBDEF=./rgb.test + +cp "$srcdir/test1.info" "$tmpdir" +cp "$srcdir/test2.info" "$tmpdir" + +test1_info="$tmpdir/test1.info" +test2_info="$tmpdir/test2.info" + +echo "Test 0.1 Should print 341768228 989" +cksum < ${test1_info} + +echo "Test 0.2 Should print 3992125899 16230" +cksum < ${test2_info} + +echo "Test 1.1 Should print 3375570914 10141" +infotopam ${test1_info} | tee ${test1_pam} | cksum + +echo "Test 1.2 Should print 1428271393 94509" +infotopam ${test2_info} | cksum + +echo "Test 2. Should print 352521340 94509" +infotopam -selected ${test2_info} | cksum + +echo "Test 3.1 Should print 3375570914 10141" +infotopam -forcecolor ${test1_info} | cksum + +echo "Test 3.2 Should print 1428271393 94509" +infotopam -forcecolor ${test2_info} | cksum + +echo "Test 4. Should print match twice" + +ppmchange rgb:00/55/AA rgb:0/0/f rgb:00/00/20 rgb:0/0/0 ${test1_pam} > ${test1ch_ppm} +infotopam -numcolors 2 0 rgb:0/0/f 2 rgb:0/0/0 ${test1_info} | pamtopnm | \ +cmp -s ${test1ch_ppm} - && echo "match" || echo "no match" + +infotopam -numcolors 4 0 rgb:00/55/AA 1 rgb:f/f/f 2 rgb:00/00/20 3 rgb:FF/8A/00 \ + ${test1_info} | \ +cmp -s ${test1_pam} - && echo "match" || echo "no match" + +rm ${test1_pam} ${test1ch_ppm} + +echo "Test Invalid" + +. ./test-invalid.inc + +invCmd "infotopam -selected ${test1_info}" +invCmd "infotopam -selected -forcecolor ${test1_info}" +invCmd "infotopam -numcolors 0 0 rgb:0/0/f ${test1_info}" +invCmd "infotopam -numcolors 1 4 rgb:0/0/f ${test1_info}" +invCmd "infotopam -numcolors 1 -1 rgb:0/0/f ${test1_info}" +invCmd "infotopam -numcolors 1 rgb:00/00/00 ${test1_info}" +invCmd "infotopam -numcolors 2 0 rgb:00/00/00 1 ${test1_info}" +invCmd "infotopam -numcolors 4 \ + rgb:0/0/f 1 rgb:0/f/0 2 rgb:/f/f/f 3 rgb:f/0/0 4 yellow ${test1_info}" +invCmd "infotopam -numcolors 5 0 \ + rgb:0/0/f 1 rgb:0/f/0 2 rgb:/f/f/f 3 rgb:f/0/0 4 rgb:f/f/0 ${test1_info}" + +rm ${test1_info} ${test2_info} diff --git a/test/rgbt.txt b/test/rgbt.txt new file mode 100644 index 00000000..96145e00 --- /dev/null +++ b/test/rgbt.txt @@ -0,0 +1,16 @@ +# This is a small color name dictionary file for test purposes. +# Values extracted from lib/rgb.txt . + 0 0 0 Black +255 255 255 White +255 0 0 Red + 0 255 0 Green + 0 0 255 Blue + 0 255 255 Cyan +255 0 255 Magenta +255 255 0 Yellow +255 138 0 Orange +160 32 240 Purple +103 67 0 Brown +128 128 128 Gray + + |