Tk Source Code

Check-in [b172326d]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Improved tests to cover StringReadPPM properly.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: b172326d5b0f3e6a7abc3c28fdb798768d2f11eb
User & Date: dkf 2013-11-03 19:56:26
Context
2013-11-05
12:47
Fix 426679ef7d: Having man.macros after .TH breaks rendering on OpenBSD and possibly others. check-in: 8b40f8ca user: jan.nijtmans tags: trunk
2013-11-03
19:56
Improved tests to cover StringReadPPM properly. check-in: b172326d user: dkf tags: trunk
19:55
Improved tests to cover StringReadPPM properly. check-in: 3db28efe user: dkf tags: core-8-5-branch
16:49
Fix StringReadPPM function from previous commit check-in: fb1fb2fd user: jan.nijtmans tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to tests/imgPPM.test.

157
158
159
160
161
162
163

































































164
165
166
167
168
169
170

test imgPPM-4.1 {StringReadPPM procedure, data too short [Bug 1822391]} -body {
    image create photo I -width 1103 -height 997
    I put "P5\n1103 997\n255\n"
} -cleanup {
    image delete I
} -returnCodes error -result {truncated PPM data}


































































imageFinish

# cleanup
catch {file delete test.ppm}
cleanupTests
return







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235

test imgPPM-4.1 {StringReadPPM procedure, data too short [Bug 1822391]} -body {
    image create photo I -width 1103 -height 997
    I put "P5\n1103 997\n255\n"
} -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

# cleanup
catch {file delete test.ppm}
cleanupTests
return