summaryrefslogtreecommitdiffstats
path: root/tests/imgPPM.test
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2013-11-03 19:55:48 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2013-11-03 19:55:48 (GMT)
commite77c3dc9fab3e8868c13d145816a64f31facc2b4 (patch)
tree5243b8012dd2d72a4db224927fd9a868b749c160 /tests/imgPPM.test
parent09b4cadaab77ddde8b0181bffaaa51f79b261ee5 (diff)
downloadtk-e77c3dc9fab3e8868c13d145816a64f31facc2b4.zip
tk-e77c3dc9fab3e8868c13d145816a64f31facc2b4.tar.gz
tk-e77c3dc9fab3e8868c13d145816a64f31facc2b4.tar.bz2
Improved tests to cover StringReadPPM properly.
Diffstat (limited to 'tests/imgPPM.test')
-rw-r--r--tests/imgPPM.test65
1 files changed, 65 insertions, 0 deletions
diff --git a/tests/imgPPM.test b/tests/imgPPM.test
index 926dbec..8dec8c2 100644
--- a/tests/imgPPM.test
+++ b/tests/imgPPM.test
@@ -156,6 +156,71 @@ test imgPPM-4.1 {StringReadPPM procedure, data too short [Bug 1822391]} \
} \
-returnCodes error \
-result {truncated PPM data}
+
+test imgPPM-5.1 {StringReadPPM procedure} -setup {
+ image create photo ppm
+} -body {
+ ppm put "P6\n0 256\n255\nabcdef"
+} -returnCodes error -cleanup {
+ image delete ppm
+} -result {PPM image data has dimension(s) <= 0}
+test imgPPM-5.2 {StringReadPPM procedure} -setup {
+ image create photo ppm
+} -body {
+ ppm put "P6\n-2 256\n255\nabcdef"
+} -returnCodes error -cleanup {
+ image delete ppm
+} -result {PPM image data has dimension(s) <= 0}
+test imgPPM-5.3 {StringReadPPM procedure} -setup {
+ image create photo ppm
+} -body {
+ ppm put "P6\n10 0\n255\nabcdef"
+} -returnCodes error -cleanup {
+ image delete ppm
+} -result {PPM image data has dimension(s) <= 0}
+test imgPPM-5.4 {StringReadPPM procedure} -setup {
+ image create photo ppm
+} -body {
+ ppm put "P6\n10 -2\n255\nabcdef"
+} -returnCodes error -cleanup {
+ image delete ppm
+} -result {PPM image data has dimension(s) <= 0}
+test imgPPM-5.5 {StringReadPPM procedure} -setup {
+ image create photo ppm
+} -body {
+ ppm put "P6\n10 20\n100000\nabcdef"
+} -returnCodes error -cleanup {
+ image delete ppm
+} -result {PPM image data has bad maximum intensity value 100000}
+test imgPPM-5.6 {StringReadPPM procedure} -setup {
+ image create photo ppm
+} -body {
+ ppm put "P6\n10 20\n0\nabcdef"
+} -returnCodes error -cleanup {
+ image delete ppm
+} -result {PPM image data has bad maximum intensity value 0}
+test imgPPM-5.7 {StringReadPPM procedure} -setup {
+ image create photo ppm
+} -body {
+ ppm put "P6\n10 10\n255\nabcdef"
+} -returnCodes error -cleanup {
+ image delete ppm
+} -result {truncated PPM data}
+test imgPPM-5.8 {StringReadPPM procedure} -setup {
+ image create photo ppm
+} -body {
+ ppm put "P6\n5 4\n255\n01234567890123456789012345678901234567890123456789012345678"
+} -returnCodes error -cleanup {
+ image delete ppm
+} -result {truncated PPM data}
+test imgPPM-5.9 {StringReadPPM procedure} -setup {
+ image create photo ppm
+} -body {
+ ppm put "P6\n5 4\n150\n012345678901234567890123456789012345678901234567890123456789"
+ list [image width ppm] [image height ppm]
+} -cleanup {
+ image delete ppm
+} -result {5 4}
eval image delete [image names]