summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonal.k.fellows@manchester.ac.uk <dkf>2013-11-03 19:56:26 (GMT)
committerdonal.k.fellows@manchester.ac.uk <dkf>2013-11-03 19:56:26 (GMT)
commit47e8aa199af1e9e5174a12b4eac7868453bbe270 (patch)
treeda5c334ef03ed2679605cf3ee33c44cebe42b12a
parent312d17d121174f1483f2c27a3afb37fc1544e9f1 (diff)
parent71b672dea8305fd3b43c87ea514e6257b5740997 (diff)
downloadtk-47e8aa199af1e9e5174a12b4eac7868453bbe270.zip
tk-47e8aa199af1e9e5174a12b4eac7868453bbe270.tar.gz
tk-47e8aa199af1e9e5174a12b4eac7868453bbe270.tar.bz2
Improved tests to cover StringReadPPM properly.
-rw-r--r--tests/imgPPM.test65
1 files changed, 65 insertions, 0 deletions
diff --git a/tests/imgPPM.test b/tests/imgPPM.test
index b5955df..e3a738a 100644
--- a/tests/imgPPM.test
+++ b/tests/imgPPM.test
@@ -161,6 +161,71 @@ test imgPPM-4.1 {StringReadPPM procedure, data too short [Bug 1822391]} -body {
} -cleanup {
image delete I
} -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}
imageFinish