|
1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 // EPOC includes |
|
17 #include <e32base.h> |
|
18 |
|
19 #include <bitdev.h> |
|
20 // Test system includes |
|
21 #include <testframework.h> |
|
22 #include <icl/imagecodecdata.h> |
|
23 #include <icl/mngimagedisplay.hrh> |
|
24 #include <icl/exifimagedisplay.hrh> |
|
25 |
|
26 #include "TestStepImageDisplay.h" |
|
27 #include "TestSuiteImageDisplay.h" |
|
28 #include "TestPlugin/TestImageDisplay.hrh" |
|
29 |
|
30 #define KDummyImage _S("Dummy.idp") |
|
31 #define KJpgImage _S("wolf.jpg") |
|
32 #define KMngImage _S("simple_b.mng") |
|
33 #define KMngEmptyFile _S("empty.mng") |
|
34 #define KDrmArchive _S("ImgDispl.content") |
|
35 |
|
36 #define KMimeTypeJpg _S8("image/jpeg") |
|
37 #define KMimeTypeMng _S8("image/mng") |
|
38 #define KMimeTypeDummy _S8("image/imgdisp") |
|
39 #define KMngUnlimUid _S("ImgDisplMngUnlim") |
|
40 #define KJpgUnlimUid _S("ImgDisplJpgUnlimited") |
|
41 |
|
42 #define KImageTypeJPGUidValue 0x101F45D8 |
|
43 |
|
44 // constant table of parameters for tests |
|
45 |
|
46 const TImageDisplayUnitTestParams KSmokeFileNameTest = |
|
47 { |
|
48 _S("MM-ICL-IMGDISP-U-0011-HP"), |
|
49 _S("The API smoke test using filename"), |
|
50 KDummyImage, // source file name |
|
51 100, 100, // dest size |
|
52 |
|
53 -1, // display mode |
|
54 CImageDisplay::EOptionMainImage, // image option |
|
55 |
|
56 ETrue, // maintain aspect ratio |
|
57 TImageDisplayUnitTestParams::ETypeFileName, // Source is a filename |
|
58 KMimeTypeDummy, // Mime type |
|
59 0, 0, // image type & subtype |
|
60 0, // plugin UID |
|
61 |
|
62 TImageDisplayUnitTestParams::ENormal // test type |
|
63 }; |
|
64 |
|
65 |
|
66 const TImageDisplayUnitTestParams KSmokeFileHandleTest = |
|
67 { |
|
68 _S("MM-ICL-IMGDISP-U-0012-HP"), |
|
69 _S("The API smoke test using filehandle"), |
|
70 KDummyImage, // source file name |
|
71 100, 100, // dest size |
|
72 |
|
73 -1, // display mode |
|
74 CImageDisplay::EOptionMainImage, // image option |
|
75 |
|
76 ETrue, // maintain aspect ratio |
|
77 TImageDisplayUnitTestParams::ETypeFileHandle, // Source is a filehandle |
|
78 KMimeTypeDummy, // Mime type |
|
79 0, 0, // image type & subtype |
|
80 0, // plugin UID |
|
81 |
|
82 TImageDisplayUnitTestParams::ENormal // test type |
|
83 }; |
|
84 |
|
85 const TImageDisplayUnitTestParams KSmokeDataBufTest = |
|
86 { |
|
87 _S("MM-ICL-IMGDISP-U-0013-HP"), |
|
88 _S("The API smoke test using DataBuffer"), |
|
89 KDummyImage, // source file name |
|
90 100, 100, // dest size |
|
91 |
|
92 -1, // display mode |
|
93 CImageDisplay::EOptionMainImage, // image option |
|
94 |
|
95 ETrue, // maintain aspect ratio |
|
96 TImageDisplayUnitTestParams::ETypeData, // Source is a databuf |
|
97 KMimeTypeDummy, // Mime type |
|
98 0, 0, // image type & subtype |
|
99 0, // plugin UID |
|
100 |
|
101 TImageDisplayUnitTestParams::ENormal // test type |
|
102 }; |
|
103 |
|
104 const TImageDisplayUnitTestParams KForceUidTest = |
|
105 { |
|
106 _S("MM-ICL-IMGDISP-U-0020-HP"), |
|
107 _S("Forcing the Plugin Uid test"), |
|
108 KJpgImage, // source file name |
|
109 100, 100, // dest size |
|
110 |
|
111 -1, // display mode |
|
112 CImageDisplay::EOptionMainImage, // image option |
|
113 |
|
114 ETrue, // maintain aspect ratio |
|
115 TImageDisplayUnitTestParams::ETypeFileName, // Source is a filename |
|
116 NULL, // Mime type |
|
117 0, 0, // image type & subtype |
|
118 KTesPluginUidValue,// plugin UID |
|
119 |
|
120 TImageDisplayUnitTestParams::ENormal // test type |
|
121 }; |
|
122 |
|
123 const TImageDisplayUnitTestParams K2FramesTest = |
|
124 { |
|
125 _S("MM-ICL-IMGDISP-U-0021-HP"), |
|
126 _S("Compare generated frame"), |
|
127 KDummyImage, // source file name |
|
128 100, 100, // dest size |
|
129 |
|
130 -1, // display mode |
|
131 CImageDisplay::EOptionMainImage, // image option |
|
132 |
|
133 ETrue, // maintain aspect ratio |
|
134 TImageDisplayUnitTestParams::ETypeFileName, // Source is a filename |
|
135 NULL, // Mime type |
|
136 0, 0, // image type & subtype |
|
137 0, // plugin UID |
|
138 |
|
139 TImageDisplayUnitTestParams::ENormal // test type |
|
140 }; |
|
141 |
|
142 //***************************************************** |
|
143 // ALLOC tests |
|
144 //***************************************************** |
|
145 |
|
146 const TImageDisplayUnitTestParams KAllocSmokeFileNameTest = |
|
147 { |
|
148 _S("MM-ICL-IMGDISP-U-0101-HP"), |
|
149 _S("The API smoke test using filename"), |
|
150 KDummyImage, // source file name |
|
151 100, 100, // dest size |
|
152 |
|
153 -1, // display mode |
|
154 CImageDisplay::EOptionMainImage, // image option |
|
155 |
|
156 ETrue, // maintain aspect ratio |
|
157 TImageDisplayUnitTestParams::ETypeFileName, // Source is a filename |
|
158 KMimeTypeDummy, // Mime type |
|
159 0, 0, // image type & subtype |
|
160 0, // plugin UID |
|
161 |
|
162 TImageDisplayUnitTestParams::EAlloc // test type |
|
163 }; |
|
164 |
|
165 |
|
166 const TImageDisplayUnitTestParams KAllocSmokeFileHandleTest = |
|
167 { |
|
168 _S("MM-ICL-IMGDISP-U-0102-HP"), |
|
169 _S("The API smoke test using filehandle"), |
|
170 KDummyImage, // source file name |
|
171 100, 100, // dest size |
|
172 |
|
173 -1, // display mode |
|
174 CImageDisplay::EOptionMainImage, // image option |
|
175 |
|
176 ETrue, // maintain aspect ratio |
|
177 TImageDisplayUnitTestParams::ETypeFileHandle, // Source is a filehandle |
|
178 KMimeTypeDummy, // Mime type |
|
179 0, 0, // image type & subtype |
|
180 0, // plugin UID |
|
181 |
|
182 TImageDisplayUnitTestParams::EAlloc // test type |
|
183 }; |
|
184 |
|
185 const TImageDisplayUnitTestParams KAllocSmokeDataBufTest = |
|
186 { |
|
187 _S("MM-ICL-IMGDISP-U-0103-HP"), |
|
188 _S("The API smoke test using DataBuffer"), |
|
189 KDummyImage, // source file name |
|
190 100, 100, // dest size |
|
191 |
|
192 -1, // display mode |
|
193 CImageDisplay::EOptionMainImage, // image option |
|
194 |
|
195 ETrue, // maintain aspect ratio |
|
196 TImageDisplayUnitTestParams::ETypeData, // Source is a databuf |
|
197 KMimeTypeDummy, // Mime type |
|
198 0, 0, // image type & subtype |
|
199 0, // plugin UID |
|
200 |
|
201 TImageDisplayUnitTestParams::EAlloc // test type |
|
202 }; |
|
203 |
|
204 |
|
205 const TImageDisplayUnitTestParams KPanicTest_1 = |
|
206 { |
|
207 _S("MM-ICL-IMGDISP-U-0001-HP"), |
|
208 _S("The API Panic test 1 (EIllegalCallSequence)"), |
|
209 KDummyImage, // source file name |
|
210 100, 100, // dest size |
|
211 |
|
212 -1, // display mode |
|
213 CImageDisplay::EOptionMainImage, // image option |
|
214 |
|
215 ETrue, // maintain aspect ratio |
|
216 TImageDisplayUnitTestParams::ETypeData, // Source is a databuf |
|
217 KMimeTypeDummy, // Mime type |
|
218 0, 0, // image type & subtype |
|
219 0, // plugin UID |
|
220 |
|
221 TImageDisplayUnitTestParams::ENormal // test type |
|
222 }; |
|
223 |
|
224 const TImageDisplayUnitTestParams KPanicTest_2 = |
|
225 { |
|
226 _S("MM-ICL-IMGDISP-U-0002-HP"), |
|
227 _S("The API Panic test 2 (EUndefinedSourceType)"), |
|
228 NULL, // source file name |
|
229 100, 100, // dest size |
|
230 |
|
231 -1, // display mode |
|
232 CImageDisplay::EOptionMainImage, // image option |
|
233 |
|
234 ETrue, // maintain aspect ratio |
|
235 TImageDisplayUnitTestParams::ETypeUndefined, // Source is undefined |
|
236 KMimeTypeDummy, // Mime type |
|
237 0, 0, // image type & subtype |
|
238 0, // plugin UID |
|
239 |
|
240 TImageDisplayUnitTestParams::ENormal // test type |
|
241 }; |
|
242 |
|
243 const TImageDisplayUnitTestParams KPanicTest_3 = |
|
244 { |
|
245 _S("MM-ICL-IMGDISP-U-0003-HP"), |
|
246 _S("The API Panic test 3 (EUndefinedDestSize)"), |
|
247 KDummyImage, // source file name |
|
248 -1, -1, // dest size |
|
249 |
|
250 -1, // display mode |
|
251 CImageDisplay::EOptionMainImage, // image option |
|
252 |
|
253 ETrue, // maintain aspect ratio |
|
254 TImageDisplayUnitTestParams::ETypeData, // Source is a databuf |
|
255 KMimeTypeDummy, // Mime type |
|
256 0, 0, // image type & subtype |
|
257 0, // plugin UID |
|
258 |
|
259 TImageDisplayUnitTestParams::ENormal // test type |
|
260 }; |
|
261 |
|
262 const TImageDisplayUnitTestParams KPanicTest_4 = |
|
263 { |
|
264 _S("MM-ICL-IMGDISP-U-0004-HP"), |
|
265 _S("The API Panic test 4 (EImageWrongType)"), |
|
266 KDummyImage, // source file name |
|
267 100, 100, // dest size |
|
268 |
|
269 -1, // display mode |
|
270 CImageDisplay::EOptionMainImage, // image option |
|
271 |
|
272 ETrue, // maintain aspect ratio |
|
273 TImageDisplayUnitTestParams::ETypeData, // Source is a databuf |
|
274 KMimeTypeDummy, // Mime type |
|
275 0, 0, // image type & subtype |
|
276 0, // plugin UID |
|
277 |
|
278 TImageDisplayUnitTestParams::ENormal // test type |
|
279 }; |
|
280 |
|
281 const TImageDisplayUnitTestParams KPanicTest_6 = |
|
282 { |
|
283 _S("MM-ICL-IMGDISP-U-0006-HP"), |
|
284 _S("The API Panic test 6 (EIllegalImageSubType)"), |
|
285 KDummyImage, // source file name |
|
286 100, 100, // dest size |
|
287 |
|
288 -1, // display mode |
|
289 CImageDisplay::EOptionMainImage, // image option |
|
290 |
|
291 ETrue, // maintain aspect ratio |
|
292 TImageDisplayUnitTestParams::ETypeFileName, // Source is a filename |
|
293 NULL, // Mime type |
|
294 0, 0x10002344, // image type & subtype |
|
295 0, // plugin UID |
|
296 |
|
297 TImageDisplayUnitTestParams::ENormal // test type |
|
298 }; |
|
299 |
|
300 // DRM negative tests // |
|
301 const TText* const KNoRightsUids[]={_S("ImgDisplNoRights"),NULL}; |
|
302 const TImageDisplayUnitTestParams KDrmNoRightsTst = |
|
303 { |
|
304 _S("MM-ICL-IMGDISP-U-0251-HP"), |
|
305 _S("Open a protected image having NO rights test"), |
|
306 KDrmArchive, // source file name |
|
307 0, 0, // dest size |
|
308 -1, // display mode |
|
309 CImageDisplay::EOptionMainImage, // image option |
|
310 |
|
311 ETrue, // maintain aspect ratio |
|
312 TImageDisplayUnitTestParams::ETypeFileName, // Source is a filename |
|
313 NULL, // Mime type |
|
314 0, 0, // image type & subtype |
|
315 0, // plugin UID |
|
316 |
|
317 TImageDisplayUnitTestParams::ENormal, // test type |
|
318 KNoRightsUids, // Unique Id |
|
319 ContentAccess::EView, // Intent |
|
320 KErrCANoRights // expected error |
|
321 }; |
|
322 |
|
323 const TText* const KUnlimitedUids[]={KMngUnlimUid, KJpgUnlimUid, NULL}; |
|
324 const TImageDisplayUnitTestParams KDrmNoPermTst = |
|
325 { |
|
326 _S("MM-ICL-IMGDISP-U-0252-HP"), |
|
327 _S("Open a protected image with Unknown intent"), |
|
328 KDrmArchive, // source file name |
|
329 0, 0, // dest size |
|
330 -1, // display mode |
|
331 CImageDisplay::EOptionMainImage, // image option |
|
332 |
|
333 ETrue, // maintain aspect ratio |
|
334 TImageDisplayUnitTestParams::ETypeFileName, // Source is a filename |
|
335 NULL, // Mime type |
|
336 0, 0, // image type & subtype |
|
337 0, // plugin UID |
|
338 |
|
339 TImageDisplayUnitTestParams::ENormal, // test type |
|
340 KUnlimitedUids, // Unique Id |
|
341 ContentAccess::EUnknown, // Intent |
|
342 KErrCANoPermission // expected error |
|
343 }; |
|
344 |
|
345 const TText* const KPlayTwiceUids[]={_S("ImgDisplJpgCnt01"), _S("ImgDisplMngCnt01"), NULL}; |
|
346 const TImageDisplayUnitTestParams KDrmLimitedCountTst = |
|
347 { |
|
348 _S("MM-ICL-IMGDISP-U-0253-HP"), |
|
349 _S("Open a protected image with View intent limited to 1 attempt, decode 2 times"), |
|
350 KDrmArchive, // source file name |
|
351 0, 0, // dest size |
|
352 -1, // display mode |
|
353 CImageDisplay::EOptionMainImage, // image option |
|
354 ETrue, // maintain aspect ratio |
|
355 TImageDisplayUnitTestParams::ETypeFileName, // Source is a filename |
|
356 NULL, // Mime type |
|
357 0, 0, // image type & subtype |
|
358 0, // plugin UID |
|
359 |
|
360 TImageDisplayUnitTestParams::ENormal, // test type |
|
361 KPlayTwiceUids, // Unique Id |
|
362 ContentAccess::EView, // Intent |
|
363 KErrCANoPermission, // expected error |
|
364 2 // iPlayLoops |
|
365 }; |
|
366 |
|
367 const TText* const KUnlimitedJpgUids[]={KJpgUnlimUid, NULL}; |
|
368 const TImageDisplayUnitTestParams KDrmMimeTypeFileNameTest = |
|
369 { |
|
370 _S("MM-ICL-IMGDISP-U-0201-HP"), |
|
371 _S("Open a protected image with View specifying MIME type, Fname"), |
|
372 KDrmArchive, // source file name |
|
373 0, 0, // dest size |
|
374 -1, // display mode |
|
375 CImageDisplay::EOptionMainImage, // image option |
|
376 ETrue, // maintain aspect ratio |
|
377 TImageDisplayUnitTestParams::ETypeFileName, // Source is a filename |
|
378 KMimeTypeJpg, // Mime type |
|
379 0, 0, // image type & subtype |
|
380 0, // plugin UID |
|
381 |
|
382 TImageDisplayUnitTestParams::ENormal, // test type |
|
383 KUnlimitedJpgUids, // Unique Id |
|
384 ContentAccess::EView, // Intent |
|
385 KErrNone, // expected error |
|
386 1 // iPlayLoops |
|
387 }; |
|
388 |
|
389 const TImageDisplayUnitTestParams KDrmMimeTypeFileHandleTest = |
|
390 { |
|
391 _S("MM-ICL-IMGDISP-U-0202-HP"), |
|
392 _S("Open a protected image with View specifying MIME type, Fhandle"), |
|
393 KDrmArchive, // source file name |
|
394 0, 0, // dest size |
|
395 -1, // display mode |
|
396 CImageDisplay::EOptionMainImage, // image option |
|
397 ETrue, // maintain aspect ratio |
|
398 TImageDisplayUnitTestParams::ETypeFileHandle, // Source is a filehandle |
|
399 KMimeTypeJpg, // Mime type |
|
400 0, 0, // image type & subtype |
|
401 0, // plugin UID |
|
402 |
|
403 TImageDisplayUnitTestParams::ENormal, // test type |
|
404 KUnlimitedJpgUids, // Unique Id |
|
405 ContentAccess::EView, // Intent |
|
406 KErrNone, // expected error |
|
407 1 // iPlayLoops |
|
408 }; |
|
409 |
|
410 const TText* const KUnlimitedMngUids[]={KMngUnlimUid, NULL}; |
|
411 const TImageDisplayUnitTestParams KDrmPluginUidTypeFileNameTest = |
|
412 { |
|
413 _S("MM-ICL-IMGDISP-U-0203-HP"), |
|
414 _S("Open a protected image with View specifying plug-in Uid, Fname"), |
|
415 KDrmArchive, // source file name |
|
416 0, 0, // dest size |
|
417 -1, // display mode |
|
418 CImageDisplay::EOptionMainImage, // image option |
|
419 ETrue, // maintain aspect ratio |
|
420 TImageDisplayUnitTestParams::ETypeFileName, // Source is a filename |
|
421 NULL, // Mime type |
|
422 0, 0, // image type & subtype |
|
423 KUidImageDisplayMngPluginImplUid, // plugin UID |
|
424 |
|
425 TImageDisplayUnitTestParams::ENormal, // test type |
|
426 KUnlimitedMngUids, // Unique Id |
|
427 ContentAccess::EView, // Intent |
|
428 KErrNone, // expected error |
|
429 1 // iPlayLoops |
|
430 }; |
|
431 |
|
432 const TImageDisplayUnitTestParams KDrmPluginUidTypeFileHandleTest = |
|
433 { |
|
434 _S("MM-ICL-IMGDISP-U-0204-HP"), |
|
435 _S("Open a protected image with View specifying plug-in Uid, Fhandle"), |
|
436 KDrmArchive, // source file name |
|
437 0, 0, // dest size |
|
438 -1, // display mode |
|
439 CImageDisplay::EOptionMainImage, // image option |
|
440 ETrue, // maintain aspect ratio |
|
441 TImageDisplayUnitTestParams::ETypeFileHandle, // Source is a filehandle |
|
442 NULL, // Mime type |
|
443 0, 0, // image type & subtype |
|
444 KUidImageDisplayMngPluginImplUid, // plugin UID |
|
445 |
|
446 TImageDisplayUnitTestParams::ENormal, // test type |
|
447 KUnlimitedMngUids, // Unique Id |
|
448 ContentAccess::EView, // Intent |
|
449 KErrNone, // expected error |
|
450 1 // iPlayLoops |
|
451 }; |
|
452 |
|
453 const TImageDisplayUnitTestParams KDrmImgTypeUidTypeFileNameTest = |
|
454 { |
|
455 _S("MM-ICL-IMGDISP-U-0205-HP"), |
|
456 _S("Open a protected image with View specifying image type Uid, Fname"), |
|
457 KDrmArchive, // source file name |
|
458 0, 0, // dest size |
|
459 -1, // display mode |
|
460 CImageDisplay::EOptionMainImage, // image option |
|
461 ETrue, // maintain aspect ratio |
|
462 TImageDisplayUnitTestParams::ETypeFileName, // Source is a filename |
|
463 NULL, // Mime type |
|
464 KImageTypeJPGUidValue, 0, // image type & subtype |
|
465 0, // plugin UID |
|
466 |
|
467 TImageDisplayUnitTestParams::ENormal, // test type |
|
468 KUnlimitedJpgUids, // Unique Id |
|
469 ContentAccess::EView, // Intent |
|
470 KErrNone, // expected error |
|
471 1 // iPlayLoops |
|
472 }; |
|
473 |
|
474 const TImageDisplayUnitTestParams KDrmImgTypeUidTypeFileHandleTest = |
|
475 { |
|
476 _S("MM-ICL-IMGDISP-U-0206-HP"), |
|
477 _S("Open a protected image with View specifying image type Uid, Fhandle"), |
|
478 KDrmArchive, // source file name |
|
479 0, 0, // dest size |
|
480 -1, // display mode |
|
481 CImageDisplay::EOptionMainImage, // image option |
|
482 ETrue, // maintain aspect ratio |
|
483 TImageDisplayUnitTestParams::ETypeFileHandle, // Source is a filehandle |
|
484 NULL, // Mime type |
|
485 KImageTypeJPGUidValue, 0, // image type & subtype |
|
486 0, // plugin UID |
|
487 |
|
488 TImageDisplayUnitTestParams::ENormal, // test type |
|
489 KUnlimitedJpgUids, // Unique Id |
|
490 ContentAccess::EView, // Intent |
|
491 KErrNone, // expected error |
|
492 1 // iPlayLoops |
|
493 }; |
|
494 |
|
495 const TImageDisplayUnitTestParams KDrmAllocFileNameTest = |
|
496 { |
|
497 _S("MM-ICL-IMGDISP-U-0111-HP"), |
|
498 _S("Open a protected image with View, Alloc, Fname"), |
|
499 KDrmArchive, // source file name |
|
500 0, 0, // dest size |
|
501 -1, // display mode |
|
502 CImageDisplay::EOptionMainImage, // image option |
|
503 ETrue, // maintain aspect ratio |
|
504 TImageDisplayUnitTestParams::ETypeFileName, // Source is a filehandle |
|
505 NULL, // Mime type |
|
506 0, 0, // image type & subtype |
|
507 0, // plugin UID |
|
508 TImageDisplayUnitTestParams::EAlloc, // test type |
|
509 KUnlimitedMngUids, // Unique Id |
|
510 ContentAccess::EView, // Intent |
|
511 KErrNone, // expected error |
|
512 1 // iPlayLoops |
|
513 }; |
|
514 |
|
515 const TImageDisplayUnitTestParams KDrmAllocFileHandleTest = |
|
516 { |
|
517 _S("MM-ICL-IMGDISP-U-0112-HP"), |
|
518 _S("Open a protected image with View, Alloc, Fhandle"), |
|
519 KDrmArchive, // source file name |
|
520 0, 0, // dest size |
|
521 -1, // display mode |
|
522 CImageDisplay::EOptionMainImage, // image option |
|
523 ETrue, // maintain aspect ratio |
|
524 TImageDisplayUnitTestParams::ETypeFileHandle, // Source is a filehandle |
|
525 NULL, // Mime type |
|
526 0, 0, // image type & subtype |
|
527 0, // plugin UID |
|
528 TImageDisplayUnitTestParams::EAlloc, // test type |
|
529 KUnlimitedJpgUids, // Unique Id |
|
530 ContentAccess::EView, // Intent |
|
531 KErrNone, // expected error |
|
532 1 // iPlayLoops |
|
533 }; |
|
534 |
|
535 const TMimeTypeRecogTestParam KMngRecogTestFileName = |
|
536 { |
|
537 _S("MM-ICL-IMGDISP-U-0301-HP"), // name of the test |
|
538 _S("Open a MNG file and get its MIME type"), // description |
|
539 TMimeTypeRecogTestParam::EParamIsFileName, // what next parameter to use |
|
540 NULL, // databuffer parameter value |
|
541 KMngImage, // filename parameter value |
|
542 KMimeTypeMng, // expected MIME type value |
|
543 CApaDataRecognizerType::EPossible // minimum confidence |
|
544 }; |
|
545 |
|
546 const TMimeTypeRecogTestParam KMngRecogTestDataBuf = |
|
547 { |
|
548 _S("MM-ICL-IMGDISP-U-0302-HP"), // name of the test |
|
549 _S("Open a MNG file and get its MIME type using its content"), // description |
|
550 TMimeTypeRecogTestParam::EParamIsDataBuffer, // what next parameter to use |
|
551 NULL, // databuffer parameter value |
|
552 KMngImage, // filename parameter value |
|
553 KMimeTypeMng, // expected MIME type value |
|
554 CApaDataRecognizerType::EPossible // minimum confidence |
|
555 }; |
|
556 |
|
557 const TMimeTypeRecogTestParam KMngRecogTestEmptyFile = |
|
558 { |
|
559 _S("MM-ICL-IMGDISP-U-0303-HP"), // name of the test |
|
560 _S("Open an empty MNG file and get its MIME type"), // description |
|
561 TMimeTypeRecogTestParam::EParamIsFileName, // what next parameter to use |
|
562 NULL, // databuffer parameter value |
|
563 KMngEmptyFile, // filename parameter value |
|
564 KMimeTypeMng, // expected MIME type value |
|
565 CApaDataRecognizerType::EPossible // minimum confidence |
|
566 }; |
|
567 |
|
568 const TMimeTypeRecogTestParam KMngRecogIncompleteSign = |
|
569 { |
|
570 _S("MM-ICL-IMGDISP-U-0304-HP"), // name of the test |
|
571 _S("Use the MNG incomplete signature and try to get its MIME type"), // description |
|
572 TMimeTypeRecogTestParam::EParamIsDataBuffer, // what next parameter to use |
|
573 _S8("\x8aMNG"), // databuffer parameter value |
|
574 _S("just_something"), // filename parameter value |
|
575 _S8(""), // expected MIME type value |
|
576 CApaDataRecognizerType::ENotRecognized // minimum confidence |
|
577 }; |
|
578 |
|
579 const TMimeTypeRecogTestParam KDummyRecogTestFileName = |
|
580 { |
|
581 _S("MM-ICL-IMGDISP-U-0305-HP"), // name of the test |
|
582 _S("Open a IDP dummy format file and get its MIME type"), // description |
|
583 TMimeTypeRecogTestParam::EParamIsFileName, // what next parameter to use |
|
584 NULL, // databuffer parameter value |
|
585 KDummyImage, // filename parameter value |
|
586 KMimeTypeDummy, // expected MIME type value |
|
587 CApaDataRecognizerType::EPossible // minimum confidence |
|
588 }; |
|
589 |
|
590 |
|
591 /** |
|
592 * |
|
593 * Create an instance of this test suite. |
|
594 * |
|
595 * NewTestSuiteImageDisplayL is exported at ordinal 1. |
|
596 * This provides the interface to allow the Test Framework |
|
597 * to create instances of this test suite. |
|
598 * |
|
599 * @return "CTestSuiteImageDisplay*" |
|
600 * The newly created test suite |
|
601 */ |
|
602 EXPORT_C CTestSuiteImageDisplay* NewTestSuiteImageDisplayL() |
|
603 { |
|
604 CTestSuiteImageDisplay* self = new (ELeave) CTestSuiteImageDisplay; |
|
605 CleanupStack::PushL(self); |
|
606 self->ConstructL(); |
|
607 |
|
608 CleanupStack::Pop(); |
|
609 return self; |
|
610 } |
|
611 |
|
612 /** |
|
613 * |
|
614 * CTestSuiteImageDisplay destructor |
|
615 * |
|
616 * |
|
617 */ |
|
618 CTestSuiteImageDisplay::~CTestSuiteImageDisplay() |
|
619 { |
|
620 if (iFBSSession) |
|
621 { |
|
622 iFBSSession = EFalse; |
|
623 RFbsSession::Disconnect(); |
|
624 } |
|
625 } |
|
626 |
|
627 /** |
|
628 * |
|
629 * This test suite version string |
|
630 * |
|
631 * |
|
632 */ |
|
633 _LIT(KTxtVersion,"1.0"); |
|
634 |
|
635 /** |
|
636 * |
|
637 * Get test suite version. |
|
638 * |
|
639 * @return "TPtrC" |
|
640 * The version string. |
|
641 * |
|
642 * |
|
643 */ |
|
644 TPtrC CTestSuiteImageDisplay::GetVersion( ) const |
|
645 { |
|
646 return KTxtVersion(); |
|
647 } |
|
648 |
|
649 /** |
|
650 * |
|
651 * Add a test step into the suite. |
|
652 * |
|
653 * @param "CTestStepImageTransform* aPtrTestStep" |
|
654 * The test step to be added. |
|
655 * |
|
656 */ |
|
657 void CTestSuiteImageDisplay::AddTestStepL(CTestStepImageDisplay* aPtrTestStep) |
|
658 { |
|
659 // [ assert pre condition that a valid test ptr has been supplied ] |
|
660 __ASSERT_ALWAYS(aPtrTestStep, Panic(EBadArgument)); |
|
661 |
|
662 // [ set back wards reference to test suite ] |
|
663 aPtrTestStep->SetSuite(this); |
|
664 |
|
665 //[ add the step to the test suite ] |
|
666 CTestSuite::AddTestStepL(aPtrTestStep); |
|
667 } |
|
668 |
|
669 /** |
|
670 * |
|
671 * Initialiser for test suite. |
|
672 * This creates all the test steps and stores them |
|
673 * inside CTestSuiteImageDisplay |
|
674 * |
|
675 */ |
|
676 void CTestSuiteImageDisplay::InitialiseL( ) |
|
677 { |
|
678 User::LeaveIfError( RFbsSession::Connect() ); |
|
679 iFBSSession = ETrue; |
|
680 |
|
681 //[ set the default path ] |
|
682 InitSystemPath(); |
|
683 |
|
684 // store the name of this test suite |
|
685 iSuiteName = _L("ImageDisplay"); |
|
686 |
|
687 // Add tests |
|
688 |
|
689 |
|
690 // smoke test |
|
691 AddTestStepL(new (ELeave) CTestStepImgDisplayGeneric(KSmokeFileNameTest)); |
|
692 |
|
693 AddTestStepL(new(ELeave) CTestStepImgDisplayGeneric(KSmokeFileHandleTest)); |
|
694 AddTestStepL(new(ELeave) CTestStepImgDisplayGeneric(KSmokeDataBufTest)); |
|
695 AddTestStepL(new(ELeave) CTestStepImgDisplayGeneric(KForceUidTest)); |
|
696 AddTestStepL(new(ELeave) CTestStepDecode2Frames(K2FramesTest)); |
|
697 |
|
698 // alloc tests // |
|
699 AddTestStepL(new(ELeave) CTestStepImgDisplayGeneric(KAllocSmokeFileNameTest)); |
|
700 AddTestStepL(new(ELeave) CTestStepImgDisplayGeneric(KAllocSmokeFileHandleTest)); |
|
701 AddTestStepL(new(ELeave) CTestStepImgDisplayGeneric(KAllocSmokeDataBufTest)); |
|
702 |
|
703 // Panic tests // |
|
704 AddTestStepL(new(ELeave) CTestStepPanic_1(KPanicTest_1)); |
|
705 AddTestStepL(new(ELeave) CTestStepPanic_2(KPanicTest_2)); |
|
706 AddTestStepL(new(ELeave) CTestStepPanic_3(KPanicTest_3)); |
|
707 AddTestStepL(new(ELeave) CTestStepPanic_4(KPanicTest_4)); |
|
708 AddTestStepL(new(ELeave) CTestStepPanic_6(KPanicTest_6)); |
|
709 |
|
710 // Drm positive tests // |
|
711 AddTestStepL(new(ELeave) CTestStepDrm(KDrmMimeTypeFileNameTest)); |
|
712 AddTestStepL(new(ELeave) CTestStepDrm(KDrmMimeTypeFileHandleTest)); |
|
713 AddTestStepL(new(ELeave) CTestStepDrm(KDrmPluginUidTypeFileNameTest)); |
|
714 AddTestStepL(new(ELeave) CTestStepDrm(KDrmPluginUidTypeFileHandleTest)); |
|
715 AddTestStepL(new(ELeave) CTestStepDrm(KDrmImgTypeUidTypeFileNameTest)); |
|
716 AddTestStepL(new(ELeave) CTestStepDrm(KDrmImgTypeUidTypeFileHandleTest)); |
|
717 |
|
718 // Drm negative tests // |
|
719 AddTestStepL(new(ELeave) CTestStepDrm(KDrmNoRightsTst)); |
|
720 AddTestStepL(new(ELeave) CTestStepDrm(KDrmNoPermTst)); |
|
721 AddTestStepL(new(ELeave) CTestStepDrm(KDrmLimitedCountTst)); |
|
722 |
|
723 // Drm alloc tests // |
|
724 AddTestStepL(new(ELeave) CTestStepDrm(KDrmAllocFileNameTest)); |
|
725 AddTestStepL(new(ELeave) CTestStepDrm(KDrmAllocFileHandleTest)); |
|
726 // Mime type recognition tests // |
|
727 AddTestStepL(new(ELeave) CTestStepImageDisplayRecog(KMngRecogTestFileName)); |
|
728 AddTestStepL(new(ELeave) CTestStepImageDisplayRecog(KMngRecogTestDataBuf)); |
|
729 AddTestStepL(new(ELeave) CTestStepImageDisplayRecog(KMngRecogTestEmptyFile)); |
|
730 AddTestStepL(new(ELeave) CTestStepImageDisplayRecog(KMngRecogIncompleteSign)); |
|
731 AddTestStepL(new(ELeave) CTestStepImageDisplayRecog(KDummyRecogTestFileName)); |
|
732 |
|
733 // Regression test case for defect: DEF082108: Browsing to www.mobil.se will crash the phone |
|
734 AddTestStepL(new(ELeave) CTestStepImageDisplayMimeCheck()); |
|
735 } |
|
736 |
|
737 void CTestSuiteImageDisplay::DefaultPath(TFileName& aName) |
|
738 { |
|
739 aName.Copy(iDefaultPath); |
|
740 } |
|
741 |
|
742 /** |
|
743 * |
|
744 * InitSystemPath |
|
745 * This sets up the default path |
|
746 * |
|
747 */ |
|
748 void CTestSuiteImageDisplay::InitSystemPath() |
|
749 { |
|
750 _LIT(KTestSourcePathOnE,"e:\\tsu_icl_imgdisp_01\\"); |
|
751 _LIT(KTestSourcePathOnD,"d:\\tsu_icl_imgdisp_01\\"); |
|
752 _LIT(KTestSourcePathOnC,"c:\\tsu_icl_imgdisp_01\\"); |
|
753 |
|
754 RFs fs; |
|
755 TInt ret = fs.Connect(); |
|
756 __ASSERT_ALWAYS(ret == KErrNone,User::Panic(_L("Sys path not setup"),ret)); |
|
757 |
|
758 //[ take the first drive where it exists or can be made ] |
|
759 TInt err = fs.MkDir(KTestSourcePathOnC); |
|
760 if (( err == KErrNone ) || (err == KErrAlreadyExists)) |
|
761 { |
|
762 iDefaultPath.Copy(KTestSourcePathOnC); |
|
763 } |
|
764 else{ |
|
765 TInt err = fs.MkDir(KTestSourcePathOnD); |
|
766 if (( err == KErrNone ) || (err == KErrAlreadyExists)) |
|
767 { |
|
768 iDefaultPath.Copy(KTestSourcePathOnD); |
|
769 } |
|
770 else |
|
771 { |
|
772 TInt err = fs.MkDir(KTestSourcePathOnE); |
|
773 if (( err == KErrNone ) || (err == KErrAlreadyExists)) |
|
774 { |
|
775 iDefaultPath.Copy(KTestSourcePathOnE); |
|
776 } |
|
777 else |
|
778 { |
|
779 User::Panic(_L("Could not make TestTransform directory"),KErrGeneral); |
|
780 } |
|
781 } |
|
782 } |
|
783 |
|
784 |
|
785 __ASSERT_ALWAYS(ret == KErrNone,User::Panic(_L("Sys path not setup"),ret)); |
|
786 fs.Close(); |
|
787 } |