|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: ExifLibTest |
|
15 * |
|
16 */ |
|
17 #include "ExifLibTestInc.h" |
|
18 |
|
19 // Test cases modified for no jpeg parsing option |
|
20 |
|
21 // Exif.Read.101 |
|
22 // Instantiate an Exif reader with valid Exif image |
|
23 // Created Exif reader instance is returned. |
|
24 void CExifReadTest::ExifRead101L() |
|
25 { |
|
26 HBufC8* exif = TUtils::ReadFileL(iFs, KFullExif, 65536); |
|
27 CleanupStack::PushL(exif); |
|
28 CExifRead* read = CExifRead::NewL(*exif, CExifRead::ENoJpeg); |
|
29 if(!read) |
|
30 User::Leave(KErrGeneral); |
|
31 delete read; |
|
32 CleanupStack::PopAndDestroy(exif); |
|
33 } |
|
34 |
|
35 // Exif.Read.102 |
|
36 // Try to instantiate an Exif reader with invalid/corrupted Exif image |
|
37 // Leaves with proper error code or doesn't detect the error |
|
38 void CExifReadTest::ExifRead102L() |
|
39 { |
|
40 // Various invalid/ corrupted Exif images |
|
41 HBufC8* exif = TUtils::ReadFileL(iFs, KInvalidExif1, 65536); |
|
42 CleanupStack::PushL(exif); |
|
43 CExifRead* read = 0; |
|
44 TRAPD( error, read = CExifRead::NewL(*exif, CExifRead::ENoJpeg) ); |
|
45 if ( error ) // jpeg error detected |
|
46 { |
|
47 if ( ( error != KErrCorrupt ) || ( read ) ) |
|
48 { |
|
49 if ( read ) |
|
50 { |
|
51 delete read; |
|
52 } |
|
53 if ( error ) |
|
54 { |
|
55 User::Leave( error ); |
|
56 } |
|
57 User::Leave(KErrGeneral); |
|
58 } |
|
59 } |
|
60 delete read; |
|
61 read = 0; |
|
62 CleanupStack::PopAndDestroy(exif); |
|
63 |
|
64 exif = TUtils::ReadFileL(iFs, KInvalidExif2, 65536); |
|
65 CleanupStack::PushL(exif); |
|
66 TRAP( error, read = CExifRead::NewL(*exif, CExifRead::ENoJpeg) ); |
|
67 if ( error ) // jpeg error detected |
|
68 { |
|
69 if ( ( error != KErrCorrupt ) || ( read ) ) |
|
70 { |
|
71 if ( read ) |
|
72 { |
|
73 delete read; |
|
74 } |
|
75 if ( error ) |
|
76 { |
|
77 User::Leave( error ); |
|
78 } |
|
79 User::Leave(KErrGeneral); |
|
80 } |
|
81 } |
|
82 delete read; |
|
83 read = 0; |
|
84 CleanupStack::PopAndDestroy(exif); |
|
85 |
|
86 exif = TUtils::CreateDummyBufL(120000); |
|
87 CleanupStack::PushL(exif); |
|
88 TRAP( error, read = CExifRead::NewL(*exif, CExifRead::ENoJpeg) ); |
|
89 if ( ( error != KErrCorrupt ) || ( read ) ) |
|
90 { |
|
91 if ( read ) |
|
92 { |
|
93 delete read; |
|
94 } |
|
95 if ( error ) |
|
96 { |
|
97 User::Leave( error ); |
|
98 } |
|
99 User::Leave(KErrGeneral); |
|
100 } |
|
101 CleanupStack::PopAndDestroy(exif); |
|
102 |
|
103 exif = TUtils::ReadFileL(iFs, KInvalidExif3, 65536); |
|
104 CleanupStack::PushL(exif); |
|
105 TRAP( error, read = CExifRead::NewL(*exif, CExifRead::ENoJpeg) ); |
|
106 if ( error ) // jpeg error detected |
|
107 { |
|
108 if ( ( error != KErrCorrupt ) || ( read ) ) |
|
109 { |
|
110 if ( read ) |
|
111 { |
|
112 delete read; |
|
113 } |
|
114 if ( error ) |
|
115 { |
|
116 User::Leave( error ); |
|
117 } |
|
118 User::Leave(KErrGeneral); |
|
119 } |
|
120 } |
|
121 delete read; |
|
122 read = 0; |
|
123 CleanupStack::PopAndDestroy(exif); |
|
124 |
|
125 exif = TUtils::ReadFileL(iFs, KInvalidExif4, 65536); |
|
126 CleanupStack::PushL(exif); |
|
127 TRAP( error, read = CExifRead::NewL(*exif, CExifRead::ENoJpeg) ); |
|
128 if ( error ) // jpeg error detected |
|
129 { |
|
130 if ( ( error != KErrCorrupt ) || ( read ) ) |
|
131 { |
|
132 if ( read ) |
|
133 { |
|
134 delete read; |
|
135 } |
|
136 if ( error ) |
|
137 { |
|
138 User::Leave( error ); |
|
139 } |
|
140 User::Leave(KErrGeneral); |
|
141 } |
|
142 } |
|
143 delete read; |
|
144 read = 0; |
|
145 CleanupStack::PopAndDestroy(exif); |
|
146 |
|
147 exif = TUtils::ReadFileL(iFs, KInvalidExif5, 65536); |
|
148 CleanupStack::PushL(exif); |
|
149 TRAP( error, read = CExifRead::NewL(*exif, CExifRead::ENoJpeg) ); |
|
150 if ( error ) // jpeg error detected |
|
151 { |
|
152 if ( ( error != KErrCorrupt ) || ( read ) ) |
|
153 { |
|
154 if ( read ) |
|
155 { |
|
156 delete read; |
|
157 } |
|
158 if ( error ) |
|
159 { |
|
160 User::Leave( error ); |
|
161 } |
|
162 User::Leave(KErrGeneral); |
|
163 } |
|
164 } |
|
165 delete read; |
|
166 read = 0; |
|
167 CleanupStack::PopAndDestroy(exif); |
|
168 |
|
169 exif = TUtils::ReadFileL(iFs, KInvalidExif7, 65536); |
|
170 CleanupStack::PushL(exif); |
|
171 TRAP( error, read = CExifRead::NewL(*exif, CExifRead::ENoJpeg) ); |
|
172 if ( error ) // jpeg error detected |
|
173 { |
|
174 if ( ( error != KErrCorrupt ) || ( read ) ) |
|
175 { |
|
176 if ( read ) |
|
177 { |
|
178 delete read; |
|
179 } |
|
180 if ( error ) |
|
181 { |
|
182 User::Leave( error ); |
|
183 } |
|
184 User::Leave(KErrGeneral); |
|
185 } |
|
186 } |
|
187 delete read; |
|
188 read = 0; |
|
189 CleanupStack::PopAndDestroy(exif); |
|
190 |
|
191 exif = TUtils::ReadFileL(iFs, KInvalidExif8, 65536); |
|
192 CleanupStack::PushL(exif); |
|
193 TRAP( error, read = CExifRead::NewL(*exif, CExifRead::ENoJpeg) ); |
|
194 if ( error ) // jpeg error detected |
|
195 { |
|
196 if ( ( error != KErrCorrupt ) || ( read ) ) |
|
197 { |
|
198 if ( read ) |
|
199 { |
|
200 delete read; |
|
201 } |
|
202 if ( error ) |
|
203 { |
|
204 User::Leave( error ); |
|
205 } |
|
206 User::Leave(KErrGeneral); |
|
207 } |
|
208 } |
|
209 delete read; |
|
210 read = 0; |
|
211 CleanupStack::PopAndDestroy(exif); |
|
212 |
|
213 exif = TUtils::ReadFileL(iFs, KInvalidExif9, 65536); |
|
214 CleanupStack::PushL(exif); |
|
215 TRAP( error, read = CExifRead::NewL(*exif, CExifRead::ENoJpeg) ); |
|
216 if ( error ) // jpeg error detected |
|
217 { |
|
218 if ( ( error != KErrCorrupt ) || ( read ) ) |
|
219 { |
|
220 if ( read ) |
|
221 { |
|
222 delete read; |
|
223 } |
|
224 if ( error ) |
|
225 { |
|
226 User::Leave( error ); |
|
227 } |
|
228 User::Leave(KErrGeneral); |
|
229 } |
|
230 } |
|
231 delete read; |
|
232 read = 0; |
|
233 CleanupStack::PopAndDestroy(exif); |
|
234 |
|
235 exif = TUtils::ReadFileL(iFs, KInvalidExif10, 65536); |
|
236 CleanupStack::PushL(exif); |
|
237 TRAP( error, read = CExifRead::NewL(*exif, CExifRead::ENoJpeg) ); |
|
238 if ( error ) // jpeg error detected |
|
239 { |
|
240 if ( ( error != KErrCorrupt ) || ( read ) ) |
|
241 { |
|
242 if ( read ) |
|
243 { |
|
244 delete read; |
|
245 } |
|
246 if ( error ) |
|
247 { |
|
248 User::Leave( error ); |
|
249 } |
|
250 User::Leave(KErrGeneral); |
|
251 } |
|
252 } |
|
253 delete read; |
|
254 read = 0; |
|
255 CleanupStack::PopAndDestroy(exif); |
|
256 |
|
257 exif = TUtils::ReadFileL(iFs, KInvalidExif11, 65536); |
|
258 CleanupStack::PushL(exif); |
|
259 TRAP( error, read = CExifRead::NewL(*exif, CExifRead::ENoJpeg) ); |
|
260 if ( error ) // jpeg error detected |
|
261 { |
|
262 if ( ( error != KErrCorrupt ) || ( read ) ) |
|
263 { |
|
264 if ( read ) |
|
265 { |
|
266 delete read; |
|
267 } |
|
268 if ( error ) |
|
269 { |
|
270 User::Leave( error ); |
|
271 } |
|
272 User::Leave(KErrGeneral); |
|
273 } |
|
274 } |
|
275 delete read; |
|
276 read = 0; |
|
277 CleanupStack::PopAndDestroy(exif); |
|
278 |
|
279 exif = TUtils::ReadFileL(iFs, KInvalidExif12, 65536); |
|
280 CleanupStack::PushL(exif); |
|
281 TRAP( error, read = CExifRead::NewL(*exif, CExifRead::ENoJpeg) ); |
|
282 if ( error ) // jpeg error detected |
|
283 { |
|
284 if ( ( error != KErrCorrupt ) || ( read ) ) |
|
285 { |
|
286 if ( read ) |
|
287 { |
|
288 delete read; |
|
289 } |
|
290 if ( error ) |
|
291 { |
|
292 User::Leave( error ); |
|
293 } |
|
294 User::Leave(KErrGeneral); |
|
295 } |
|
296 } |
|
297 delete read; |
|
298 read = 0; |
|
299 CleanupStack::PopAndDestroy(exif); |
|
300 |
|
301 exif = TUtils::ReadFileL(iFs, KInvalidExif13, 65536); |
|
302 CleanupStack::PushL(exif); |
|
303 TRAP( error, read = CExifRead::NewL(*exif, CExifRead::ENoJpeg) ); |
|
304 if ( error ) // jpeg error detected |
|
305 { |
|
306 if ( ( error != KErrCorrupt ) || ( read ) ) |
|
307 { |
|
308 if ( read ) |
|
309 { |
|
310 delete read; |
|
311 } |
|
312 if ( error ) |
|
313 { |
|
314 User::Leave( error ); |
|
315 } |
|
316 User::Leave(KErrGeneral); |
|
317 } |
|
318 } |
|
319 delete read; |
|
320 read = 0; |
|
321 CleanupStack::PopAndDestroy(exif); |
|
322 |
|
323 /* Supported, but uncompressed thumbnail is skipped */ |
|
324 exif = TUtils::ReadFileL(iFs, KNotSupportedExif1, 65536); |
|
325 CleanupStack::PushL(exif); |
|
326 TRAP( error, read = CExifRead::NewL(*exif, CExifRead::ENoJpeg) ); |
|
327 if ( ( error != KErrNone ) || ( !read ) ) |
|
328 { |
|
329 if ( read ) |
|
330 { |
|
331 delete read; |
|
332 } |
|
333 if ( error ) |
|
334 { |
|
335 User::Leave( error ); |
|
336 } |
|
337 User::Leave(KErrGeneral); |
|
338 } |
|
339 delete read; |
|
340 read = 0; |
|
341 CleanupStack::PopAndDestroy(exif); |
|
342 |
|
343 /* Supported, but unsupported (uncompressed) thumbnail is skipped */ |
|
344 exif = TUtils::ReadFileL(iFs, KNotSupportedExif2, 65536); |
|
345 CleanupStack::PushL(exif); |
|
346 TRAP( error, read = CExifRead::NewL(*exif, CExifRead::ENoJpeg) ); |
|
347 if ( ( error != KErrCorrupt ) ) |
|
348 { |
|
349 if ( read ) |
|
350 { |
|
351 delete read; |
|
352 } |
|
353 if ( error ) |
|
354 { |
|
355 User::Leave( error ); |
|
356 } |
|
357 User::Leave(KErrGeneral); |
|
358 } |
|
359 delete read; |
|
360 read = 0; |
|
361 CleanupStack::PopAndDestroy(exif); |
|
362 |
|
363 // Corrupted with more than 64k tag data |
|
364 exif = TUtils::ReadFileL(iFs, KInvalidExif14, 65536); |
|
365 CleanupStack::PushL(exif); |
|
366 TRAP( error, read = CExifRead::NewL(*exif, CExifRead::ENoJpeg) ); |
|
367 if ( error ) // jpeg error detected |
|
368 { |
|
369 if ( ( error != KErrCorrupt ) ) |
|
370 { |
|
371 if ( read ) |
|
372 { |
|
373 delete read; |
|
374 } |
|
375 if ( error ) |
|
376 { |
|
377 User::Leave( error ); |
|
378 } |
|
379 User::Leave(KErrGeneral); |
|
380 } |
|
381 } |
|
382 delete read; |
|
383 read = 0; |
|
384 CleanupStack::PopAndDestroy(exif); |
|
385 |
|
386 } |
|
387 |
|
388 |
|
389 // Exif.Read.103 |
|
390 // Retrieve a tag existing in the specified IFD from Exif data. |
|
391 // The requested tag instance (unmodifiable / const) is returned. |
|
392 void CExifReadTest::ExifRead103L() |
|
393 { |
|
394 // For each IFD. |
|
395 HBufC8* exif = TUtils::ReadFileL(iFs, KFullExif, 65536); |
|
396 CleanupStack::PushL(exif); |
|
397 CExifRead* read = CExifRead::NewL(*exif, CExifRead::ENoJpeg); |
|
398 CleanupStack::PushL(read); |
|
399 |
|
400 const CExifTag* tag = read->GetTagL(EIfd0, KIdXResolution); |
|
401 if(!tag) |
|
402 User::Leave(KErrGeneral); |
|
403 |
|
404 tag = read->GetTagL(EIfdExif, KIdColorSpace); |
|
405 if(!tag) |
|
406 User::Leave(KErrGeneral); |
|
407 |
|
408 tag = read->GetTagL(EIfd1, KIdCompression); |
|
409 if(!tag) |
|
410 User::Leave(KErrGeneral); |
|
411 |
|
412 tag = read->GetTagL(EIfdIntOp, 1); |
|
413 if(!tag) |
|
414 User::Leave(KErrGeneral); |
|
415 |
|
416 tag = read->GetTagL(EIfdGps, KIdGpsVersion); |
|
417 if(!tag) |
|
418 User::Leave(KErrGeneral); |
|
419 |
|
420 CleanupStack::PopAndDestroy(read); |
|
421 CleanupStack::PopAndDestroy(exif); |
|
422 } |
|
423 |
|
424 |
|
425 // Exif.Read.104 |
|
426 // Try to retrieve a tag which doesn't exist in the Exif data. |
|
427 // Leaves with proper error code. |
|
428 void CExifReadTest::ExifRead104L() |
|
429 { |
|
430 HBufC8* exif = TUtils::ReadFileL(iFs, KValidExif, 65536); |
|
431 CleanupStack::PushL(exif); |
|
432 CExifRead* read = CExifRead::NewL(*exif, CExifRead::ENoJpeg); |
|
433 CleanupStack::PushL(read); |
|
434 |
|
435 const CExifTag* tag = NULL; |
|
436 // IFD exists but tag doesn't exist, |
|
437 TRAPD(error, tag = read->GetTagL(EIfd0, KIdArtist)); |
|
438 if(error != KErrNotFound) |
|
439 { |
|
440 if(error) |
|
441 User::Leave(error); |
|
442 else |
|
443 User::Leave(KErrGeneral); |
|
444 } |
|
445 |
|
446 // IFD doesn't exist |
|
447 TRAP(error, tag = read->GetTagL(EIfdGps, KIdGpsVersion)); |
|
448 if(error != KErrNotFound) |
|
449 { |
|
450 if(error) |
|
451 User::Leave(error); |
|
452 else |
|
453 User::Leave(KErrGeneral); |
|
454 } |
|
455 |
|
456 CleanupStack::PopAndDestroy(read); |
|
457 CleanupStack::PopAndDestroy(exif); |
|
458 } |
|
459 |
|
460 |
|
461 // Exif.Read.105 |
|
462 // Try to retrieve a tag with invalid parameters. |
|
463 // Leaves with proper error code. |
|
464 void CExifReadTest::ExifRead105L() |
|
465 { |
|
466 HBufC8* exif = TUtils::ReadFileL(iFs, KFullExif, 65536); |
|
467 CleanupStack::PushL(exif); |
|
468 CExifRead* read = CExifRead::NewL(*exif, CExifRead::ENoJpeg); |
|
469 CleanupStack::PushL(read); |
|
470 |
|
471 const CExifTag* tag; |
|
472 // Tag ID is invalid |
|
473 TRAPD(error, tag = read->GetTagL(EIfdExif, 200)); |
|
474 if(error != KErrNotSupported) |
|
475 { |
|
476 if(error) |
|
477 User::Leave(error); |
|
478 else |
|
479 User::Leave(KErrGeneral); |
|
480 } |
|
481 |
|
482 // Tag cannot exist in the specified IFD. |
|
483 TRAP(error, tag = read->GetTagL(EIfdGps, KIdImageDescription)); |
|
484 if(error != KErrNotSupported) |
|
485 { |
|
486 if(error) |
|
487 User::Leave(error); |
|
488 else |
|
489 User::Leave(KErrGeneral); |
|
490 } |
|
491 |
|
492 CleanupStack::PopAndDestroy(read); |
|
493 CleanupStack::PopAndDestroy(exif); |
|
494 } |
|
495 |
|
496 |
|
497 // Exif.Read.106 |
|
498 // Retrieve the IDs of tags from an IFD in Exif data. |
|
499 // Returns the tag IDs and the number of IDs |
|
500 void CExifReadTest::ExifRead106L() |
|
501 { |
|
502 // For each IFD. |
|
503 HBufC8* exif = TUtils::ReadFileL(iFs, KFullExif, 65536); |
|
504 CleanupStack::PushL(exif); |
|
505 CExifRead* read = CExifRead::NewL(*exif, CExifRead::ENoJpeg); |
|
506 CleanupStack::PushL(read); |
|
507 |
|
508 TInt no = 0; |
|
509 TUint16* tags = read->GetTagIdsL(EIfd0, no); |
|
510 if((!tags) || (no != 14)) |
|
511 { |
|
512 if(tags) |
|
513 delete tags; |
|
514 User::Leave(KErrGeneral); |
|
515 } |
|
516 delete tags; |
|
517 tags = 0; |
|
518 |
|
519 tags = read->GetTagIdsL(EIfdExif, no); |
|
520 if((!tags) || (no != 41)) |
|
521 { |
|
522 if(tags) |
|
523 delete tags; |
|
524 User::Leave(KErrGeneral); |
|
525 } |
|
526 delete tags; |
|
527 tags = 0; |
|
528 |
|
529 tags = read->GetTagIdsL(EIfd1, no); |
|
530 if((!tags) || (no != 6)) |
|
531 { |
|
532 if(tags) |
|
533 delete tags; |
|
534 User::Leave(KErrGeneral); |
|
535 } |
|
536 delete tags; |
|
537 tags = 0; |
|
538 |
|
539 tags = read->GetTagIdsL(EIfdIntOp, no); |
|
540 if((!tags) || (no != 4)) |
|
541 { |
|
542 if(tags) |
|
543 delete tags; |
|
544 User::Leave(KErrGeneral); |
|
545 } |
|
546 delete tags; |
|
547 tags = 0; |
|
548 |
|
549 tags = read->GetTagIdsL(EIfdGps, no); |
|
550 if((!tags) || (no != 4)) |
|
551 { |
|
552 if(tags) |
|
553 delete tags; |
|
554 User::Leave(KErrGeneral); |
|
555 } |
|
556 delete tags; |
|
557 tags = 0; |
|
558 |
|
559 CleanupStack::PopAndDestroy(read); |
|
560 CleanupStack::PopAndDestroy(exif); |
|
561 } |
|
562 |
|
563 |
|
564 // Exif.Read.107 |
|
565 // Try to retrieve the IDs of tags from an IFD, which doesn't exist in Exif data. |
|
566 // Leaves with proper error code. |
|
567 void CExifReadTest::ExifRead107L() |
|
568 { |
|
569 HBufC8* exif = TUtils::ReadFileL(iFs, KValidExif, 65536); |
|
570 CleanupStack::PushL(exif); |
|
571 CExifRead* read = CExifRead::NewL(*exif, CExifRead::ENoJpeg); |
|
572 CleanupStack::PushL(read); |
|
573 |
|
574 TInt no = 0; |
|
575 TUint16* tags = NULL; |
|
576 TRAPD(error, tags = read->GetTagIdsL(EIfdGps, no)); |
|
577 if(tags) |
|
578 delete tags; |
|
579 if(error != KErrNotFound) |
|
580 { |
|
581 if(error) |
|
582 User::Leave(error); |
|
583 else |
|
584 User::Leave(KErrGeneral); |
|
585 } |
|
586 CleanupStack::PopAndDestroy(read); |
|
587 CleanupStack::PopAndDestroy(exif); |
|
588 } |
|
589 |
|
590 |
|
591 // Exif.Read.108 |
|
592 // Retrieve the types of IFDs included in Exif data. |
|
593 // Returns the IFD types and the number of IFDs. |
|
594 void CExifReadTest::ExifRead108L() |
|
595 { |
|
596 HBufC8* exif = TUtils::ReadFileL(iFs, KValidExif, 65536); |
|
597 CleanupStack::PushL(exif); |
|
598 CExifRead* read = CExifRead::NewL(*exif, CExifRead::ENoJpeg); |
|
599 CleanupStack::PushL(read); |
|
600 |
|
601 TInt no = 0; |
|
602 TExifIfdType* ifds = read->GetIfdTypesL(no); |
|
603 if((!ifds) && (no != 4)) |
|
604 { |
|
605 if(ifds) |
|
606 delete ifds; |
|
607 User::Leave(KErrGeneral); |
|
608 } |
|
609 delete ifds; |
|
610 CleanupStack::PopAndDestroy(read); |
|
611 CleanupStack::PopAndDestroy(exif); |
|
612 } |
|
613 |
|
614 |
|
615 // Exif.Read.109 |
|
616 // Retrieve a copy of existing Exif thumbnail image from Exif data. |
|
617 // Returns the Exif thumbnail image. |
|
618 void CExifReadTest::ExifRead109L() |
|
619 { |
|
620 HBufC8* exif = TUtils::ReadFileL(iFs, KValidExif, 65536); |
|
621 CleanupStack::PushL(exif); |
|
622 CExifRead* read = CExifRead::NewL(*exif, CExifRead::ENoJpeg); |
|
623 CleanupStack::PushL(read); |
|
624 |
|
625 HBufC8* thumbnail = read->GetThumbnailL(); |
|
626 if(!thumbnail) |
|
627 User::Leave(KErrGeneral); |
|
628 |
|
629 delete thumbnail; |
|
630 CleanupStack::PopAndDestroy(read); |
|
631 CleanupStack::PopAndDestroy(exif); |
|
632 } |
|
633 |
|
634 |
|
635 // Exif.Read.110 |
|
636 // Try to retrieve a copy of Exif thumbnail image from Exif data that doesn't contain compressed Exif thumbnail image. |
|
637 // Leaves with proper error code. |
|
638 void CExifReadTest::ExifRead110L() |
|
639 { |
|
640 HBufC8* exif = TUtils::ReadFileL(iFs, KNoThumbnail, 65536); |
|
641 CleanupStack::PushL(exif); |
|
642 CExifRead* read = CExifRead::NewL(*exif, CExifRead::ENoJpeg); |
|
643 CleanupStack::PushL(read); |
|
644 |
|
645 HBufC8* thumbnail = NULL; |
|
646 TRAPD(error, thumbnail = read->GetThumbnailL()); |
|
647 if(thumbnail) |
|
648 delete thumbnail; |
|
649 if(error != KErrNotFound) |
|
650 { |
|
651 if(error) |
|
652 User::Leave(error); |
|
653 else |
|
654 User::Leave(KErrGeneral); |
|
655 } |
|
656 CleanupStack::PopAndDestroy(read); |
|
657 CleanupStack::PopAndDestroy(exif); |
|
658 } |
|
659 |
|
660 |
|
661 // Exif.Read.111 |
|
662 // Check if an IFD exists in Exif data. |
|
663 // Returns ETrue if specified IFD exists, EFalse otherwise. |
|
664 void CExifReadTest::ExifRead111L() |
|
665 { |
|
666 // For each IFD |
|
667 HBufC8* exif = TUtils::ReadFileL(iFs, KValidExif, 65536); |
|
668 CleanupStack::PushL(exif); |
|
669 CExifRead* read = CExifRead::NewL(*exif, CExifRead::ENoJpeg); |
|
670 CleanupStack::PushL(read); |
|
671 |
|
672 // IFD exists, |
|
673 if(!read->IfdExists(EIfd0)) |
|
674 User::Leave(KErrGeneral); |
|
675 if(!read->IfdExists(EIfdExif)) |
|
676 User::Leave(KErrGeneral); |
|
677 if(!read->IfdExists(EIfd1)) |
|
678 User::Leave(KErrGeneral); |
|
679 if(!read->IfdExists(EIfdIntOp)) |
|
680 User::Leave(KErrGeneral); |
|
681 // IFD doesn't exist. |
|
682 if(read->IfdExists(EIfdGps)) |
|
683 User::Leave(KErrGeneral); |
|
684 |
|
685 CleanupStack::PopAndDestroy(read); |
|
686 CleanupStack::PopAndDestroy(exif); |
|
687 } |
|
688 |
|
689 |
|
690 // Exif.Read.112 |
|
691 // Check if a tag exists in the specified IFD of Exif data. |
|
692 // Returns ETrue if tag exists in the specified IFD, EFalse otherwise. |
|
693 void CExifReadTest::ExifRead112L() |
|
694 { |
|
695 // For each IFD; |
|
696 HBufC8* exif = TUtils::ReadFileL(iFs, KValidExif, 65536); |
|
697 CleanupStack::PushL(exif); |
|
698 CExifRead* read = CExifRead::NewL(*exif, CExifRead::ENoJpeg); |
|
699 CleanupStack::PushL(read); |
|
700 |
|
701 // Tag exists in IFD, |
|
702 if(!read->TagExists(KIdXResolution, EIfd0)) |
|
703 User::Leave(KErrGeneral); |
|
704 if(!read->TagExists(KIdComponentsConfiguration, EIfdExif)) |
|
705 User::Leave(KErrGeneral); |
|
706 if(!read->TagExists(1, EIfdIntOp)) |
|
707 User::Leave(KErrGeneral); |
|
708 // IFD exists but tag doesn't exist, |
|
709 if(read->TagExists(KIdCopyright, EIfd1)) |
|
710 User::Leave(KErrGeneral); |
|
711 // IFD doesn't exist |
|
712 if(read->TagExists(KIdGpsVersion, EIfdGps)) |
|
713 User::Leave(KErrGeneral); |
|
714 |
|
715 CleanupStack::PopAndDestroy(read); |
|
716 CleanupStack::PopAndDestroy(exif); |
|
717 } |
|
718 |
|
719 |
|
720 // Exif.Read.113 |
|
721 // Retrieve specific data using Get functions. |
|
722 // Returns the requested data. |
|
723 void CExifReadTest::ExifRead113L() |
|
724 { |
|
725 HBufC8* exif = TUtils::ReadFileL(iFs, KFullExif, 65536); |
|
726 CleanupStack::PushL(exif); |
|
727 CExifRead* read = CExifRead::NewL(*exif, CExifRead::ENoJpeg); |
|
728 CleanupStack::PushL(read); |
|
729 |
|
730 // For some Get functions. |
|
731 HBufC8* data = read->GetImageDescriptionL(); |
|
732 if(!data) |
|
733 User::Leave(KErrGeneral); |
|
734 delete data; |
|
735 data = 0; |
|
736 |
|
737 data = read->GetMakeL(); |
|
738 if(!data) |
|
739 User::Leave(KErrGeneral); |
|
740 delete data; |
|
741 data = 0; |
|
742 |
|
743 data = read->GetDateTimeOriginalL(); |
|
744 if(!data) |
|
745 User::Leave(KErrGeneral); |
|
746 delete data; |
|
747 data = 0; |
|
748 |
|
749 data = read->GetTransferFunctionL(); |
|
750 if(!data) |
|
751 User::Leave(KErrGeneral); |
|
752 delete data; |
|
753 data = 0; |
|
754 |
|
755 data = read->GetRelatedSoundFileL(); |
|
756 if(!data) |
|
757 User::Leave(KErrGeneral); |
|
758 delete data; |
|
759 data = 0; |
|
760 |
|
761 data = read->GetModelL(); |
|
762 if(!data) |
|
763 User::Leave(KErrGeneral); |
|
764 delete data; |
|
765 data = 0; |
|
766 |
|
767 data = read->GetMakerNoteL(); |
|
768 if(!data) |
|
769 User::Leave(KErrGeneral); |
|
770 delete data; |
|
771 data = 0; |
|
772 |
|
773 data = read->GetIsoSpeedRatingsL(); |
|
774 if(!data) |
|
775 User::Leave(KErrGeneral); |
|
776 delete data; |
|
777 data = 0; |
|
778 |
|
779 data = read->GetDateTimeDigitizedL(); |
|
780 if(!data) |
|
781 User::Leave(KErrGeneral); |
|
782 delete data; |
|
783 data = 0; |
|
784 |
|
785 data = read->GetCopyrightL(); |
|
786 if(!data) |
|
787 User::Leave(KErrGeneral); |
|
788 delete data; |
|
789 data = 0; |
|
790 |
|
791 |
|
792 TUint16 uInt16 = 0; |
|
793 TUint32 uInt32 = 0; |
|
794 TUint32 uInt32i = 0; |
|
795 TInt32 int32 = 0; |
|
796 TInt32 int32i = 0; |
|
797 TInt8 int8 = 0; |
|
798 TUint8 a1 = 0; |
|
799 TUint8 a2 = 0; |
|
800 TUint8 a3 = 0; |
|
801 TUint8 a4 = 0; |
|
802 |
|
803 User::LeaveIfError(read->GetExposureTime(uInt32, uInt32i)); |
|
804 if((uInt32 != 0) || (uInt32i != 0)) |
|
805 User::Leave(KErrGeneral); |
|
806 User::LeaveIfError(read->GetShutterSpeedValue(int32, int32i)); |
|
807 if((int32 != 0x00087383) || (int32i != 0x00010000)) |
|
808 User::Leave(KErrGeneral); |
|
809 User::LeaveIfError(read->GetBrightnessValue(int32, int32i)); |
|
810 if((int32 != 0) || (int32i != 1)) |
|
811 User::Leave(KErrGeneral); |
|
812 User::LeaveIfError(read->GetCustomRendered(uInt16)); |
|
813 if(uInt16 != 0) |
|
814 User::Leave(KErrGeneral); |
|
815 User::LeaveIfError(read->GetGainControl(uInt16)); |
|
816 if(uInt16 != 0) |
|
817 User::Leave(KErrGeneral); |
|
818 User::LeaveIfError(read->GetGpsVersion(uInt32)); |
|
819 if(uInt32 != 0x00000202) |
|
820 User::Leave(KErrGeneral); |
|
821 User::LeaveIfError(read->GetComponentsConfiguration(a1, a2, a3, a4)); |
|
822 if((a1 != 1) || (a2 != 2) || (a3 != 3 ) || (a4 != 0)) |
|
823 User::Leave(KErrGeneral); |
|
824 User::LeaveIfError(read->GetOrientation(uInt16)); |
|
825 if(uInt16 != 1) |
|
826 User::Leave(KErrGeneral); |
|
827 User::LeaveIfError(read->GetXResolution(uInt32, uInt32i)); |
|
828 if((uInt32 != 180) || (uInt32i != 1)) |
|
829 User::Leave(KErrGeneral); |
|
830 User::LeaveIfError(read->GetExifIfdPointer(uInt32)); |
|
831 if(uInt32 != 1798) |
|
832 User::Leave(KErrGeneral); |
|
833 User::LeaveIfError(read->GetFileSource(int8)); |
|
834 if(int8 != 3) |
|
835 User::Leave(KErrGeneral); |
|
836 User::LeaveIfError(read->GetSharpness(uInt16)); |
|
837 if(uInt16 != 0) |
|
838 User::Leave(KErrGeneral); |
|
839 User::LeaveIfError(read->GetExifVersion(uInt32)); |
|
840 if(uInt32 != 0x30323230) |
|
841 User::Leave(KErrGeneral); |
|
842 User::LeaveIfError(read->GetThumbnailXResolution(uInt32, uInt32i)); |
|
843 if((uInt32 != 180) || (uInt32i != 1)) |
|
844 User::Leave(KErrGeneral); |
|
845 User::LeaveIfError(read->GetThumbnailCompression(uInt16)); |
|
846 if(uInt16 != 6) |
|
847 User::Leave(KErrGeneral); |
|
848 User::LeaveIfError(read->GetJpegInterchangeFormat(uInt32)); |
|
849 if(uInt32 != 2814) |
|
850 User::Leave(KErrGeneral); |
|
851 User::LeaveIfError(read->GetWhiteBalance(uInt16)); |
|
852 if(uInt16 != 0) |
|
853 User::Leave(KErrGeneral); |
|
854 User::LeaveIfError(read->GetSceneCaptureType(uInt16)); |
|
855 if(uInt16 != 0) |
|
856 User::Leave(KErrGeneral); |
|
857 User::LeaveIfError(read->GetSaturation(uInt16)); |
|
858 if(uInt16 != 0) |
|
859 User::Leave(KErrGeneral); |
|
860 User::LeaveIfError(read->GetMeteringMode(uInt16)); |
|
861 if(uInt16 != 2) |
|
862 User::Leave(KErrGeneral); |
|
863 User::LeaveIfError(read->GetJpegInterchangeFormatLength(uInt32)); |
|
864 if(uInt32 != 5342) |
|
865 User::Leave(KErrGeneral); |
|
866 User::LeaveIfError(read->GetInteroperabilityIfdPointer(uInt32)); |
|
867 if(uInt32 != 2666) |
|
868 User::Leave(KErrGeneral); |
|
869 User::LeaveIfError(read->GetGpsInfoIfdPointer(uInt32)); |
|
870 if(uInt32 != 2612) |
|
871 User::Leave(KErrGeneral); |
|
872 User::LeaveIfError(read->GetFlashPixVersion(uInt32)); |
|
873 if(uInt32 != 0x30303130) |
|
874 User::Leave(KErrGeneral); |
|
875 User::LeaveIfError(read->GetExposureProgram(uInt16)); |
|
876 if(uInt16 != 0) |
|
877 User::Leave(KErrGeneral); |
|
878 User::LeaveIfError(read->GetExposureMode(uInt16)); |
|
879 if(uInt16 != 0) |
|
880 User::Leave(KErrGeneral); |
|
881 User::LeaveIfError(read->GetExposureBiasValue(int32, int32i)); |
|
882 if((int32 != 0) || (int32i != 3)) |
|
883 User::Leave(KErrGeneral); |
|
884 User::LeaveIfError(read->GetContrast(uInt16)); |
|
885 if(uInt16 != 0) |
|
886 User::Leave(KErrGeneral); |
|
887 User::LeaveIfError(read->GetApertureValue(uInt32, uInt32i)); |
|
888 if((uInt32 != 262144) || (uInt32i != 65536)) |
|
889 User::Leave(KErrGeneral); |
|
890 |
|
891 |
|
892 CleanupStack::PopAndDestroy(read); |
|
893 CleanupStack::PopAndDestroy(exif); |
|
894 } |
|
895 |
|
896 |
|
897 // Exif.Read.114 |
|
898 // Try to retrieve specific data that is not present in the Exif data using Get functions. |
|
899 // Leaves with or returns proper error code. |
|
900 void CExifReadTest::ExifRead114L() |
|
901 { |
|
902 HBufC8* exif = TUtils::ReadFileL(iFs, KNoThumbnail, 65536); |
|
903 CleanupStack::PushL(exif); |
|
904 CExifRead* read = CExifRead::NewL(*exif, CExifRead::ENoJpeg); |
|
905 CleanupStack::PushL(read); |
|
906 |
|
907 // For some Get functions. |
|
908 HBufC8* data = NULL; |
|
909 TRAPD(error, data = read->GetSoftwareL()); |
|
910 if(data) |
|
911 delete data; |
|
912 data = 0; |
|
913 if(error != KErrNotFound) |
|
914 { |
|
915 if(error) |
|
916 User::Leave(error); |
|
917 else |
|
918 User::Leave(KErrGeneral); |
|
919 } |
|
920 TRAP(error, data = read->GetUserCommentL()); |
|
921 if(data) |
|
922 delete data; |
|
923 data = 0; |
|
924 if(error != KErrNotFound) |
|
925 { |
|
926 if(error) |
|
927 User::Leave(error); |
|
928 else |
|
929 User::Leave(KErrGeneral); |
|
930 } |
|
931 |
|
932 TUint16 uInt16 = 0; |
|
933 TUint32 uInt32 = 0; |
|
934 TUint32 uInt32i = 0; |
|
935 TInt8 int8 = 0; |
|
936 error = read->GetLightSource(uInt16); |
|
937 if(error != KErrNotFound) |
|
938 { |
|
939 if(error) |
|
940 User::Leave(error); |
|
941 else |
|
942 User::Leave(KErrGeneral); |
|
943 } |
|
944 error = read->GetFileSource(int8); |
|
945 if(error != KErrNotFound) |
|
946 { |
|
947 if(error) |
|
948 User::Leave(error); |
|
949 else |
|
950 User::Leave(KErrGeneral); |
|
951 } |
|
952 error = read->GetDigitalZoomRatio(uInt32, uInt32i); |
|
953 if(error != KErrNotFound) |
|
954 { |
|
955 if(error) |
|
956 User::Leave(error); |
|
957 else |
|
958 User::Leave(KErrGeneral); |
|
959 } |
|
960 error = read->GetThumbnailCompression(uInt16); |
|
961 if(error != KErrNotFound) |
|
962 { |
|
963 if(error) |
|
964 User::Leave(error); |
|
965 else |
|
966 User::Leave(KErrGeneral); |
|
967 } |
|
968 error = read->GetJpegInterchangeFormat(uInt32); |
|
969 if(error != KErrNotFound) |
|
970 { |
|
971 if(error) |
|
972 User::Leave(error); |
|
973 else |
|
974 User::Leave(KErrGeneral); |
|
975 } |
|
976 |
|
977 CleanupStack::PopAndDestroy(read); |
|
978 CleanupStack::PopAndDestroy(exif); |
|
979 } |
|
980 |
|
981 // Exif.Read.116 |
|
982 // Retrieve the Exif APP1 segment. |
|
983 // Returns the whole Exif APP1 segment. |
|
984 void CExifReadTest::ExifRead116L() |
|
985 { |
|
986 |
|
987 HBufC8* exif = TUtils::ReadFileL(iFs, KValidExif, 65536); |
|
988 CleanupStack::PushL(exif); |
|
989 CExifRead* read = CExifRead::NewL(*exif, CExifRead::ENoJpeg); |
|
990 CleanupStack::PushL(read); |
|
991 |
|
992 HBufC8* appSegment = read->GetExifAppSegmentL(); |
|
993 CleanupStack::PushL( appSegment ); |
|
994 if ( appSegment->Length() != 12670 ) |
|
995 { |
|
996 User::Leave( KErrGeneral ); |
|
997 } |
|
998 if ( *appSegment->Ptr() != 0xff ) |
|
999 { |
|
1000 User::Leave( KErrGeneral ); |
|
1001 } |
|
1002 if ( *( appSegment->Ptr() + appSegment->Length() - 1 ) != 0xd9 ) |
|
1003 { |
|
1004 User::Leave( KErrGeneral ); |
|
1005 } |
|
1006 CleanupStack::PopAndDestroy( appSegment ); |
|
1007 |
|
1008 CleanupStack::PopAndDestroy(read); |
|
1009 CleanupStack::PopAndDestroy(exif); |
|
1010 |
|
1011 exif = TUtils::ReadFileL(iFs, KFullExif, 65536); |
|
1012 CleanupStack::PushL(exif); |
|
1013 read = CExifRead::NewL(*exif, CExifRead::ENoJpeg); |
|
1014 CleanupStack::PushL(read); |
|
1015 |
|
1016 appSegment = read->GetExifAppSegmentL(); |
|
1017 CleanupStack::PushL( appSegment ); |
|
1018 if ( appSegment->Length() != 8166 ) |
|
1019 { |
|
1020 User::Leave( KErrGeneral ); |
|
1021 } |
|
1022 if ( *appSegment->Ptr() != 0xff ) |
|
1023 { |
|
1024 User::Leave( KErrGeneral ); |
|
1025 } |
|
1026 if ( *( appSegment->Ptr() + appSegment->Length() - 1 ) != 0xd9 ) |
|
1027 { |
|
1028 User::Leave( KErrGeneral ); |
|
1029 } |
|
1030 CleanupStack::PopAndDestroy( appSegment ); |
|
1031 |
|
1032 CleanupStack::PopAndDestroy(read); |
|
1033 CleanupStack::PopAndDestroy(exif); |
|
1034 } |
|
1035 |
|
1036 // Exif.Read.115 |
|
1037 // Test the behavior of the previous test cases in OOM situations. |
|
1038 // Successfully operates or leaves with OOM error, without any memory leaks. |
|
1039 void CExifReadTest::ExifRead115L() |
|
1040 { |
|
1041 // OOM in EXIF.READ.101- EXIF.READ.116 |
|
1042 TInt error = KErrGeneral; |
|
1043 TInt i = 0; |
|
1044 |
|
1045 RDebug::Print(_L("ExifRead101L() memory test")); |
|
1046 #if ( ( defined __WINS__ ) || ( defined __WINSCW__) ) |
|
1047 for(i = 1; i < 500; i++) |
|
1048 #else |
|
1049 for(i = 1; i < 10; i++) |
|
1050 #endif |
|
1051 { |
|
1052 __UHEAP_MARK; |
|
1053 #if ( ( defined __WINS__ ) || ( defined __WINSCW__) ) |
|
1054 __UHEAP_SETFAIL( RHeap::EFailNext, i ); |
|
1055 #else |
|
1056 __UHEAP_SETFAIL( RHeap::ERandom, i ); |
|
1057 #endif |
|
1058 TRAP(error, ExifRead101L()); |
|
1059 if(error) |
|
1060 { |
|
1061 if(error != KErrNoMemory) |
|
1062 { |
|
1063 __UHEAP_SETFAIL( RHeap::ENone, 0 ); |
|
1064 RDebug::Print((_L("ExifRead115L() TRAP error=%d")),error); |
|
1065 User::Leave(KErrGeneral); |
|
1066 } |
|
1067 } |
|
1068 else |
|
1069 { |
|
1070 __UHEAP_MARKEND; |
|
1071 break; |
|
1072 } |
|
1073 __UHEAP_MARKEND; |
|
1074 } |
|
1075 |
|
1076 __UHEAP_SETFAIL( RHeap::ENone, 0 ); |
|
1077 RDebug::Print(_L("ExifRead102L() memory test")); |
|
1078 #if ( ( defined __WINS__ ) || ( defined __WINSCW__) ) |
|
1079 for(i = 1; i < 500; i++) |
|
1080 #else |
|
1081 for(i = 1; i < 10; i++) |
|
1082 #endif |
|
1083 { |
|
1084 // RDebug::Print((_L("ExifRead102L() memory test i=%d")),i); |
|
1085 __UHEAP_MARK; |
|
1086 #if ( ( defined __WINS__ ) || ( defined __WINSCW__) ) |
|
1087 __UHEAP_SETFAIL( RHeap::EFailNext, i ); |
|
1088 #else |
|
1089 __UHEAP_SETFAIL( RHeap::ERandom, i ); |
|
1090 #endif |
|
1091 TRAP(error, ExifRead102L()); |
|
1092 if(error) |
|
1093 { |
|
1094 if(error != KErrNoMemory) |
|
1095 { |
|
1096 RDebug::Print((_L("ExifRead115L() TRAP error=%d")),error); |
|
1097 __UHEAP_SETFAIL( RHeap::ENone, 0 ); |
|
1098 User::Leave(KErrGeneral); |
|
1099 } |
|
1100 } |
|
1101 else |
|
1102 { |
|
1103 __UHEAP_MARKEND; |
|
1104 break; |
|
1105 } |
|
1106 __UHEAP_MARKEND; |
|
1107 } |
|
1108 |
|
1109 __UHEAP_SETFAIL( RHeap::ENone, 0 ); |
|
1110 RDebug::Print(_L("ExifRead103L() memory test")); |
|
1111 #if ( ( defined __WINS__ ) || ( defined __WINSCW__) ) |
|
1112 for(i = 1; i < 500; i++) |
|
1113 #else |
|
1114 for(i = 1; i < 10; i++) |
|
1115 #endif |
|
1116 { |
|
1117 __UHEAP_MARK; |
|
1118 #if ( ( defined __WINS__ ) || ( defined __WINSCW__) ) |
|
1119 __UHEAP_SETFAIL( RHeap::EFailNext, i ); |
|
1120 #else |
|
1121 __UHEAP_SETFAIL( RHeap::ERandom, i ); |
|
1122 #endif |
|
1123 TRAP(error, ExifRead103L()); |
|
1124 if(error) |
|
1125 { |
|
1126 if(error != KErrNoMemory) |
|
1127 { |
|
1128 RDebug::Print((_L("ExifRead115L() TRAP error=%d")),error); |
|
1129 __UHEAP_SETFAIL( RHeap::ENone, 0 ); |
|
1130 User::Leave(KErrGeneral); |
|
1131 } |
|
1132 } |
|
1133 else |
|
1134 { |
|
1135 __UHEAP_MARKEND; |
|
1136 break; |
|
1137 } |
|
1138 __UHEAP_MARKEND; |
|
1139 } |
|
1140 |
|
1141 __UHEAP_SETFAIL( RHeap::ENone, 0 ); |
|
1142 RDebug::Print(_L("ExifRead104L() memory test")); |
|
1143 #if ( ( defined __WINS__ ) || ( defined __WINSCW__) ) |
|
1144 for(i = 1; i < 500; i++) |
|
1145 #else |
|
1146 for(i = 1; i < 10; i++) |
|
1147 #endif |
|
1148 { |
|
1149 __UHEAP_MARK; |
|
1150 #if ( ( defined __WINS__ ) || ( defined __WINSCW__) ) |
|
1151 __UHEAP_SETFAIL( RHeap::EFailNext, i ); |
|
1152 #else |
|
1153 __UHEAP_SETFAIL( RHeap::ERandom, i ); |
|
1154 #endif |
|
1155 TRAP(error, ExifRead104L()); |
|
1156 if(error) |
|
1157 { |
|
1158 if(error != KErrNoMemory) |
|
1159 { |
|
1160 RDebug::Print((_L("ExifRead115L() TRAP error=%d")),error); |
|
1161 __UHEAP_SETFAIL( RHeap::ENone, 0 ); |
|
1162 User::Leave(KErrGeneral); |
|
1163 } |
|
1164 } |
|
1165 else |
|
1166 { |
|
1167 __UHEAP_MARKEND; |
|
1168 break; |
|
1169 } |
|
1170 __UHEAP_MARKEND; |
|
1171 } |
|
1172 |
|
1173 __UHEAP_SETFAIL( RHeap::ENone, 0 ); |
|
1174 RDebug::Print(_L("ExifRead105L() memory test")); |
|
1175 #if ( ( defined __WINS__ ) || ( defined __WINSCW__) ) |
|
1176 for(i = 1; i < 500; i++) |
|
1177 #else |
|
1178 for(i = 1; i < 10; i++) |
|
1179 #endif |
|
1180 { |
|
1181 __UHEAP_MARK; |
|
1182 #if ( ( defined __WINS__ ) || ( defined __WINSCW__) ) |
|
1183 __UHEAP_SETFAIL( RHeap::EFailNext, i ); |
|
1184 #else |
|
1185 __UHEAP_SETFAIL( RHeap::ERandom, i ); |
|
1186 #endif |
|
1187 TRAP(error, ExifRead105L()); |
|
1188 if(error) |
|
1189 { |
|
1190 if(error != KErrNoMemory) |
|
1191 { |
|
1192 RDebug::Print((_L("ExifRead115L() TRAP error=%d")),error); |
|
1193 __UHEAP_SETFAIL( RHeap::ENone, 0 ); |
|
1194 User::Leave(KErrGeneral); |
|
1195 } |
|
1196 } |
|
1197 else |
|
1198 { |
|
1199 __UHEAP_MARKEND; |
|
1200 break; |
|
1201 } |
|
1202 __UHEAP_MARKEND; |
|
1203 } |
|
1204 |
|
1205 __UHEAP_SETFAIL( RHeap::ENone, 0 ); |
|
1206 RDebug::Print(_L("ExifRead106L() memory test")); |
|
1207 #if ( ( defined __WINS__ ) || ( defined __WINSCW__) ) |
|
1208 for(i = 1; i < 500; i++) |
|
1209 #else |
|
1210 for(i = 1; i < 10; i++) |
|
1211 #endif |
|
1212 { |
|
1213 __UHEAP_MARK; |
|
1214 #if ( ( defined __WINS__ ) || ( defined __WINSCW__) ) |
|
1215 __UHEAP_SETFAIL( RHeap::EFailNext, i ); |
|
1216 #else |
|
1217 __UHEAP_SETFAIL( RHeap::ERandom, i ); |
|
1218 #endif |
|
1219 TRAP(error, ExifRead106L()); |
|
1220 if(error) |
|
1221 { |
|
1222 if(error != KErrNoMemory) |
|
1223 { |
|
1224 RDebug::Print((_L("ExifRead115L() TRAP error=%d")),error); |
|
1225 __UHEAP_SETFAIL( RHeap::ENone, 0 ); |
|
1226 User::Leave(KErrGeneral); |
|
1227 } |
|
1228 } |
|
1229 else |
|
1230 { |
|
1231 __UHEAP_MARKEND; |
|
1232 break; |
|
1233 } |
|
1234 __UHEAP_MARKEND; |
|
1235 } |
|
1236 |
|
1237 __UHEAP_SETFAIL( RHeap::ENone, 0 ); |
|
1238 RDebug::Print(_L("ExifRead107L() memory test")); |
|
1239 #if ( ( defined __WINS__ ) || ( defined __WINSCW__) ) |
|
1240 for(i = 1; i < 500; i++) |
|
1241 #else |
|
1242 for(i = 1; i < 10; i++) |
|
1243 #endif |
|
1244 { |
|
1245 __UHEAP_MARK; |
|
1246 #if ( ( defined __WINS__ ) || ( defined __WINSCW__) ) |
|
1247 __UHEAP_SETFAIL( RHeap::EFailNext, i ); |
|
1248 #else |
|
1249 __UHEAP_SETFAIL( RHeap::ERandom, i ); |
|
1250 #endif |
|
1251 TRAP(error, ExifRead107L()); |
|
1252 if(error) |
|
1253 { |
|
1254 if(error != KErrNoMemory) |
|
1255 { |
|
1256 RDebug::Print((_L("ExifRead115L() TRAP error=%d")),error); |
|
1257 __UHEAP_SETFAIL( RHeap::ENone, 0 ); |
|
1258 User::Leave(KErrGeneral); |
|
1259 } |
|
1260 } |
|
1261 else |
|
1262 { |
|
1263 __UHEAP_MARKEND; |
|
1264 break; |
|
1265 } |
|
1266 __UHEAP_MARKEND; |
|
1267 } |
|
1268 |
|
1269 __UHEAP_SETFAIL( RHeap::ENone, 0 ); |
|
1270 RDebug::Print(_L("ExifRead108L() memory test")); |
|
1271 #if ( ( defined __WINS__ ) || ( defined __WINSCW__) ) |
|
1272 for(i = 1; i < 500; i++) |
|
1273 #else |
|
1274 for(i = 1; i < 10; i++) |
|
1275 #endif |
|
1276 { |
|
1277 __UHEAP_MARK; |
|
1278 #if ( ( defined __WINS__ ) || ( defined __WINSCW__) ) |
|
1279 __UHEAP_SETFAIL( RHeap::EFailNext, i ); |
|
1280 #else |
|
1281 __UHEAP_SETFAIL( RHeap::ERandom, i ); |
|
1282 #endif |
|
1283 TRAP(error, ExifRead108L()); |
|
1284 if(error) |
|
1285 { |
|
1286 if(error != KErrNoMemory) |
|
1287 { |
|
1288 RDebug::Print((_L("ExifRead115L() TRAP error=%d")),error); |
|
1289 __UHEAP_SETFAIL( RHeap::ENone, 0 ); |
|
1290 User::Leave(KErrGeneral); |
|
1291 } |
|
1292 } |
|
1293 else |
|
1294 { |
|
1295 __UHEAP_MARKEND; |
|
1296 break; |
|
1297 } |
|
1298 __UHEAP_MARKEND; |
|
1299 } |
|
1300 |
|
1301 __UHEAP_SETFAIL( RHeap::ENone, 0 ); |
|
1302 RDebug::Print(_L("ExifRead109L() memory test")); |
|
1303 #if ( ( defined __WINS__ ) || ( defined __WINSCW__) ) |
|
1304 for(i = 1; i < 500; i++) |
|
1305 #else |
|
1306 for(i = 1; i < 10; i++) |
|
1307 #endif |
|
1308 { |
|
1309 __UHEAP_MARK; |
|
1310 #if ( ( defined __WINS__ ) || ( defined __WINSCW__) ) |
|
1311 __UHEAP_SETFAIL( RHeap::EFailNext, i ); |
|
1312 #else |
|
1313 __UHEAP_SETFAIL( RHeap::ERandom, i ); |
|
1314 #endif |
|
1315 TRAP(error, ExifRead109L()); |
|
1316 if(error) |
|
1317 { |
|
1318 if(error != KErrNoMemory) |
|
1319 { |
|
1320 RDebug::Print((_L("ExifRead115L() TRAP error=%d")),error); |
|
1321 __UHEAP_SETFAIL( RHeap::ENone, 0 ); |
|
1322 User::Leave(KErrGeneral); |
|
1323 } |
|
1324 } |
|
1325 else |
|
1326 { |
|
1327 __UHEAP_MARKEND; |
|
1328 break; |
|
1329 } |
|
1330 __UHEAP_MARKEND; |
|
1331 } |
|
1332 |
|
1333 __UHEAP_SETFAIL( RHeap::ENone, 0 ); |
|
1334 RDebug::Print(_L("ExifRead110L() memory test")); |
|
1335 #if ( ( defined __WINS__ ) || ( defined __WINSCW__) ) |
|
1336 for(i = 1; i < 500; i++) |
|
1337 #else |
|
1338 for(i = 1; i < 10; i++) |
|
1339 #endif |
|
1340 { |
|
1341 __UHEAP_MARK; |
|
1342 #if ( ( defined __WINS__ ) || ( defined __WINSCW__) ) |
|
1343 __UHEAP_SETFAIL( RHeap::EFailNext, i ); |
|
1344 #else |
|
1345 __UHEAP_SETFAIL( RHeap::ERandom, i ); |
|
1346 #endif |
|
1347 TRAP(error, ExifRead110L()); |
|
1348 if(error) |
|
1349 { |
|
1350 if(error != KErrNoMemory) |
|
1351 { |
|
1352 RDebug::Print((_L("ExifRead115L() TRAP error=%d")),error); |
|
1353 __UHEAP_SETFAIL( RHeap::ENone, 0 ); |
|
1354 User::Leave(KErrGeneral); |
|
1355 } |
|
1356 } |
|
1357 else |
|
1358 { |
|
1359 __UHEAP_MARKEND; |
|
1360 break; |
|
1361 } |
|
1362 __UHEAP_MARKEND; |
|
1363 } |
|
1364 |
|
1365 __UHEAP_SETFAIL( RHeap::ENone, 0 ); |
|
1366 RDebug::Print(_L("ExifRead111L() memory test")); |
|
1367 #if ( ( defined __WINS__ ) || ( defined __WINSCW__) ) |
|
1368 for(i = 1; i < 500; i++) |
|
1369 #else |
|
1370 for(i = 1; i < 10; i++) |
|
1371 #endif |
|
1372 { |
|
1373 __UHEAP_MARK; |
|
1374 #if ( ( defined __WINS__ ) || ( defined __WINSCW__) ) |
|
1375 __UHEAP_SETFAIL( RHeap::EFailNext, i ); |
|
1376 #else |
|
1377 __UHEAP_SETFAIL( RHeap::ERandom, i ); |
|
1378 #endif |
|
1379 TRAP(error, ExifRead111L()); |
|
1380 if(error) |
|
1381 { |
|
1382 if(error != KErrNoMemory) |
|
1383 { |
|
1384 RDebug::Print((_L("ExifRead115L() TRAP error=%d")),error); |
|
1385 __UHEAP_SETFAIL( RHeap::ENone, 0 ); |
|
1386 User::Leave(KErrGeneral); |
|
1387 } |
|
1388 } |
|
1389 else |
|
1390 { |
|
1391 __UHEAP_MARKEND; |
|
1392 break; |
|
1393 } |
|
1394 __UHEAP_MARKEND; |
|
1395 } |
|
1396 |
|
1397 __UHEAP_SETFAIL( RHeap::ENone, 0 ); |
|
1398 RDebug::Print(_L("ExifRead112L() memory test")); |
|
1399 #if ( ( defined __WINS__ ) || ( defined __WINSCW__) ) |
|
1400 for(i = 1; i < 500; i++) |
|
1401 #else |
|
1402 for(i = 1; i < 10; i++) |
|
1403 #endif |
|
1404 { |
|
1405 __UHEAP_MARK; |
|
1406 #if ( ( defined __WINS__ ) || ( defined __WINSCW__) ) |
|
1407 __UHEAP_SETFAIL( RHeap::EFailNext, i ); |
|
1408 #else |
|
1409 __UHEAP_SETFAIL( RHeap::ERandom, i ); |
|
1410 #endif |
|
1411 TRAP(error, ExifRead112L()); |
|
1412 if(error) |
|
1413 { |
|
1414 if(error != KErrNoMemory) |
|
1415 { |
|
1416 RDebug::Print((_L("ExifRead115L() TRAP error=%d")),error); |
|
1417 __UHEAP_SETFAIL( RHeap::ENone, 0 ); |
|
1418 User::Leave(KErrGeneral); |
|
1419 } |
|
1420 } |
|
1421 else |
|
1422 { |
|
1423 __UHEAP_MARKEND; |
|
1424 break; |
|
1425 } |
|
1426 __UHEAP_MARKEND; |
|
1427 } |
|
1428 |
|
1429 __UHEAP_SETFAIL( RHeap::ENone, 0 ); |
|
1430 RDebug::Print(_L("ExifRead113L() memory test")); |
|
1431 #if ( ( defined __WINS__ ) || ( defined __WINSCW__) ) |
|
1432 for(i = 1; i < 500; i++) |
|
1433 #else |
|
1434 for(i = 1; i < 10; i++) |
|
1435 #endif |
|
1436 { |
|
1437 __UHEAP_MARK; |
|
1438 #if ( ( defined __WINS__ ) || ( defined __WINSCW__) ) |
|
1439 __UHEAP_SETFAIL( RHeap::EFailNext, i ); |
|
1440 #else |
|
1441 __UHEAP_SETFAIL( RHeap::ERandom, i ); |
|
1442 #endif |
|
1443 TRAP(error, ExifRead113L()); |
|
1444 if(error) |
|
1445 { |
|
1446 if(error != KErrNoMemory) |
|
1447 { |
|
1448 RDebug::Print((_L("ExifRead115L() TRAP error=%d")),error); |
|
1449 __UHEAP_SETFAIL( RHeap::ENone, 0 ); |
|
1450 User::Leave(KErrGeneral); |
|
1451 } |
|
1452 } |
|
1453 else |
|
1454 { |
|
1455 __UHEAP_MARKEND; |
|
1456 break; |
|
1457 } |
|
1458 __UHEAP_MARKEND; |
|
1459 } |
|
1460 |
|
1461 __UHEAP_SETFAIL( RHeap::ENone, 0 ); |
|
1462 RDebug::Print(_L("ExifRead114L() memory test")); |
|
1463 #if ( ( defined __WINS__ ) || ( defined __WINSCW__) ) |
|
1464 for(i = 1; i < 500; i++) |
|
1465 #else |
|
1466 for(i = 1; i < 10; i++) |
|
1467 #endif |
|
1468 { |
|
1469 __UHEAP_MARK; |
|
1470 #if ( ( defined __WINS__ ) || ( defined __WINSCW__) ) |
|
1471 __UHEAP_SETFAIL( RHeap::EFailNext, i ); |
|
1472 #else |
|
1473 __UHEAP_SETFAIL( RHeap::ERandom, i ); |
|
1474 #endif |
|
1475 TRAP(error, ExifRead114L()); |
|
1476 if(error) |
|
1477 { |
|
1478 if(error != KErrNoMemory) |
|
1479 { |
|
1480 RDebug::Print((_L("ExifRead115L() TRAP error=%d")),error); |
|
1481 __UHEAP_SETFAIL( RHeap::ENone, 0 ); |
|
1482 User::Leave(KErrGeneral); |
|
1483 } |
|
1484 } |
|
1485 else |
|
1486 { |
|
1487 __UHEAP_MARKEND; |
|
1488 break; |
|
1489 } |
|
1490 __UHEAP_MARKEND; |
|
1491 } |
|
1492 |
|
1493 __UHEAP_SETFAIL( RHeap::ENone, 0 ); |
|
1494 RDebug::Print(_L("ExifRead116L() memory test")); |
|
1495 #if ( ( defined __WINS__ ) || ( defined __WINSCW__) ) |
|
1496 for(i = 1; i < 500; i++) |
|
1497 #else |
|
1498 for(i = 1; i < 10; i++) |
|
1499 #endif |
|
1500 { |
|
1501 __UHEAP_MARK; |
|
1502 #if ( ( defined __WINS__ ) || ( defined __WINSCW__) ) |
|
1503 __UHEAP_SETFAIL( RHeap::EFailNext, i ); |
|
1504 #else |
|
1505 __UHEAP_SETFAIL( RHeap::ERandom, i ); |
|
1506 #endif |
|
1507 TRAP(error, ExifRead116L()); |
|
1508 if(error) |
|
1509 { |
|
1510 if(error != KErrNoMemory) |
|
1511 { |
|
1512 RDebug::Print((_L("ExifRead115L() TRAP error=%d")),error); |
|
1513 __UHEAP_SETFAIL( RHeap::ENone, 0 ); |
|
1514 User::Leave(KErrGeneral); |
|
1515 } |
|
1516 } |
|
1517 else |
|
1518 { |
|
1519 __UHEAP_MARKEND; |
|
1520 break; |
|
1521 } |
|
1522 __UHEAP_MARKEND; |
|
1523 } |
|
1524 |
|
1525 __UHEAP_SETFAIL( RHeap::ENone, 0 ); |
|
1526 } |
|
1527 |