|
1 // Copyright (c) 2002-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 // This file contains the test steps ICL positive testing |
|
15 // EPOC includes |
|
16 // |
|
17 // |
|
18 |
|
19 #include <testframework.h> |
|
20 #include "TestPositiveConversion.h" |
|
21 |
|
22 const TInt KMaxMimeLength = 256; |
|
23 |
|
24 CTestPositiveConversion *CTestPositiveConversion::NewL(const TDesC& aTestName) |
|
25 { |
|
26 CTestPositiveConversion* self = new(ELeave) CTestPositiveConversion(aTestName); |
|
27 return self; |
|
28 |
|
29 } |
|
30 |
|
31 /** |
|
32 * |
|
33 * |
|
34 * do the test step |
|
35 * |
|
36 */ |
|
37 TVerdict CTestPositiveConversion::DoTestStepL() |
|
38 { |
|
39 TVerdict currentVerdict = EPass; |
|
40 |
|
41 if( (iTestStepName.Compare(_L("MM-ICL-FRM-I-0001-CP")) == 0) || |
|
42 (iTestStepName.Compare(_L("MM-ICL-FRM-I-0002-CP")) == 0) || |
|
43 (iTestStepName.Compare(_L("MM-ICL-FRM-I-0003-CP")) == 0) || |
|
44 (iTestStepName.Compare(_L("MM-ICL-FRM-I-0004-CP")) == 0) || |
|
45 (iTestStepName.Compare(_L("MM-ICL-FRM-I-0005-CP")) == 0) || |
|
46 (iTestStepName.Compare(_L("MM-ICL-FRM-I-0006-CP")) == 0) || |
|
47 (iTestStepName.Compare(_L("MM-ICL-FRM-I-0007-CP")) == 0) || |
|
48 (iTestStepName.Compare(_L("MM-ICL-FRM-I-0008-CP")) == 0) || |
|
49 (iTestStepName.Compare(_L("MM-ICL-FRM-I-0009-CP")) == 0) || |
|
50 (iTestStepName.Compare(_L("MM-ICL-FRM-I-0010-CP")) == 0)) |
|
51 currentVerdict = Step0001_0010_CP(); |
|
52 else if( (iTestStepName.Compare(_L("MM-ICL-FRM-I-0011-CP")) == 0) || |
|
53 (iTestStepName.Compare(_L("MM-ICL-FRM-I-0012-CP")) == 0) || |
|
54 (iTestStepName.Compare(_L("MM-ICL-FRM-I-0013-CP")) == 0) || |
|
55 (iTestStepName.Compare(_L("MM-ICL-FRM-I-0014-CP")) == 0)) |
|
56 currentVerdict = Step0011_0014_CP(); |
|
57 else if( iTestStepName.Compare(_L("MM-ICL-FRM-I-0015-CP")) == 0) |
|
58 currentVerdict = Step0015_CP(); |
|
59 else if (iTestStepName.Compare(_L("MM-ICL-FRM-I-0200-CP")) == 0) |
|
60 currentVerdict = Step0200_CP(); |
|
61 else if( iTestStepName.Compare(_L("MM-ICL-FRM-I-0016-CP")) == 0) |
|
62 currentVerdict = Step0016_CP(); |
|
63 else if( iTestStepName.Compare(_L("MM-ICL-FRM-I-0017-CP")) == 0) |
|
64 currentVerdict = Step0017_CP(); |
|
65 else if( iTestStepName.Compare(_L("MM-ICL-FRM-I-0101-LP")) == 0) |
|
66 currentVerdict = Step0101_LP(); |
|
67 else if( iTestStepName.Compare(_L("MM-ICL-FRM-I-0102-LP")) == 0) |
|
68 currentVerdict = Step0102_LP(); |
|
69 else if( iTestStepName.Compare(_L("MM-ICL-FRM-I-0103-LP")) == 0) |
|
70 currentVerdict = Step0103_LP(); |
|
71 else if( iTestStepName.Compare(_L("MM-ICL-FRM-I-0104-LP")) == 0) |
|
72 currentVerdict = Step0104_LP(); |
|
73 else if( iTestStepName.Compare(_L("MM-ICL-FRM-I-0105-LP")) == 0) |
|
74 currentVerdict = Step0105_LP(); |
|
75 else if( iTestStepName.Compare(_L("MM-ICL-FRM-I-0106-HP")) == 0) |
|
76 currentVerdict = Step0106_HP(); |
|
77 else if( iTestStepName.Compare(_L("MM-ICL-FRM-I-0107-HP")) == 0) |
|
78 currentVerdict = Step0107_HP(); |
|
79 else if( iTestStepName.Compare(_L("MM-ICL-FRM-I-0109-HP")) == 0) |
|
80 currentVerdict = Step0109_HP(); |
|
81 else if( iTestStepName.Compare(_L("MM-ICL-FRM-I-0110-HP")) == 0) |
|
82 currentVerdict = Step0110_HP(); |
|
83 else if( iTestStepName.Compare(_L("MM-ICL-FRM-I-0111-HP")) == 0) |
|
84 currentVerdict = Step0111_HP(); |
|
85 else if( iTestStepName.Compare(_L("MM-ICL-FRM-I-0112-HP")) == 0) |
|
86 currentVerdict = Step0112_HP(); |
|
87 else if( iTestStepName.Compare(_L("MM-ICL-FRM-I-0113-CP")) == 0) |
|
88 currentVerdict = Step0113_CP(); |
|
89 else if( iTestStepName.Compare(_L("MM-ICL-FRM-I-0114-HP")) == 0) |
|
90 currentVerdict = Step0114_HP(); |
|
91 else if( iTestStepName.Compare(_L("MM-ICL-FRM-I-0115-HP")) == 0) |
|
92 currentVerdict = Step0115_HP(); |
|
93 else if( iTestStepName.Compare(_L("MM-ICL-FRM-I-0300-HP")) == 0) |
|
94 currentVerdict = Step0300_HP(); |
|
95 else if( iTestStepName.Compare(_L("MM-ICL-FRM-I-0600-HP")) == 0) |
|
96 currentVerdict = Step0600_HP(); |
|
97 else if( iTestStepName.Compare(_L("MM-ICL-FRM-I-0601-HP")) == 0) |
|
98 currentVerdict = Step0601_HP(); |
|
99 else if( iTestStepName.Compare(_L("MM-ICL-FRM-I-0608-HP")) == 0) |
|
100 currentVerdict = Step0608_HP(); |
|
101 else if( iTestStepName.Compare(_L("MM-ICL-FRM-I-0609-HP")) == 0) |
|
102 currentVerdict = Step0609_HP(); |
|
103 else if( iTestStepName.Compare(_L("MM-ICL-FRM-I-0610-HP")) == 0) |
|
104 currentVerdict = Step0610_HP(); |
|
105 else if( iTestStepName.Compare(_L("MM-ICL-FRM-I-0611-HP")) == 0) |
|
106 currentVerdict = Step0611_HP(); |
|
107 else if (iTestStepName.Compare(_L("MM-ICL-FRM-I-0612-HP")) == 0 ) |
|
108 currentVerdict = Step0612_HP(); |
|
109 else if (iTestStepName.Compare(_L("MM-ICL-FRM-I-0613-HP")) == 0 ) |
|
110 currentVerdict = Step0613_HP(); |
|
111 else if (iTestStepName.Compare(_L("MM-ICL-FRM-I-0614-HP")) == 0 ) |
|
112 currentVerdict = Step0614_HP(); |
|
113 else if (iTestStepName.Compare(_L("MM-ICL-FRM-I-0615-HP")) == 0 ) |
|
114 currentVerdict = Step0615_HP(); |
|
115 else if (iTestStepName.Compare(_L("MM-ICL-FRM-I-0616-HP")) == 0 ) |
|
116 currentVerdict = Step0616_HP(); |
|
117 else if (iTestStepName.Compare(_L("MM-ICL-FRM-I-0617-HP")) == 0 ) |
|
118 currentVerdict = Step0617_HP(); |
|
119 |
|
120 return currentVerdict; |
|
121 } |
|
122 |
|
123 /** |
|
124 * |
|
125 * Read, decode and verify different graphic formats |
|
126 * |
|
127 * Step 0001_CP for 0010_CP |
|
128 * |
|
129 */ |
|
130 TVerdict CTestPositiveConversion::Step0001_0010_CP() |
|
131 { |
|
132 TVerdict result = EFail ; |
|
133 TInt theErr = KErrNone; |
|
134 TInt theErr1 = KErrNone; |
|
135 |
|
136 // dummy Hal call for heap balance on target |
|
137 if (DummyHalCall() != KErrNone) |
|
138 return EInconclusive; |
|
139 |
|
140 __MM_HEAP_MARK; |
|
141 TInt err = RFbsSession::Connect(); |
|
142 if (err != KErrNone) |
|
143 { |
|
144 INFO_PRINTF2(_L("RFbsSession::Connect() failed, err = %d"), err); |
|
145 return EInconclusive; |
|
146 } |
|
147 |
|
148 if(iImageTypeUid == KImageTypeWBMPUid || |
|
149 iImageTypeUid == KImageTypeOTAUid) |
|
150 { |
|
151 INFO_PRINTF2(_L("This type graphic demands UId %d"), &iImageTypeUid); |
|
152 TRAP(theErr1, theErr = OpenImageForDecodeFromFileL(iFileNameSrc, iImageTypeUid)); |
|
153 } |
|
154 else |
|
155 { |
|
156 TRAP(theErr1, theErr = OpenImageForDecodeFromFileL(iFileNameSrc)); |
|
157 } |
|
158 |
|
159 RFbsSession::Disconnect(); |
|
160 |
|
161 __MM_HEAP_MARKEND; |
|
162 |
|
163 if(theErr1 != KErrNone) |
|
164 theErr = theErr1; |
|
165 |
|
166 if(theErr == KErrNone) |
|
167 { |
|
168 result = EPass; |
|
169 } |
|
170 else |
|
171 INFO_PRINTF2(_L("Error : %d"), theErr); |
|
172 |
|
173 return result; |
|
174 } |
|
175 |
|
176 /** |
|
177 * |
|
178 * Encode and verify different graphic formats |
|
179 * |
|
180 */ |
|
181 TVerdict CTestPositiveConversion::Step0011_0014_CP() |
|
182 { |
|
183 TVerdict result = EFail ; |
|
184 TInt theErr = KErrNone; |
|
185 TInt theErr1 = KErrNone; |
|
186 |
|
187 __MM_HEAP_MARK; |
|
188 TInt err = RFbsSession::Connect(); |
|
189 if (err != KErrNone) |
|
190 { |
|
191 INFO_PRINTF2(_L("RFbsSession::Connect() failed, err = %d"), err); |
|
192 return EInconclusive; |
|
193 } |
|
194 |
|
195 TRAP(theErr1, theErr = EncodeImageToMemoryL(iFileNameSrc, iImageTypeUid)); |
|
196 |
|
197 RFbsSession::Disconnect(); |
|
198 |
|
199 __MM_HEAP_MARKEND; |
|
200 |
|
201 if(theErr1 != KErrNone) |
|
202 theErr = theErr1; |
|
203 |
|
204 if(theErr == KErrNone && theErr1 == KErrNone) |
|
205 { |
|
206 result = EPass; |
|
207 } |
|
208 else |
|
209 INFO_PRINTF2(_L("Error : %d"), theErr); |
|
210 |
|
211 return result; |
|
212 |
|
213 } |
|
214 |
|
215 |
|
216 /** |
|
217 * |
|
218 * Encode an image from memory to |
|
219 * a file |
|
220 * |
|
221 */ |
|
222 TVerdict CTestPositiveConversion::Step0015_CP() |
|
223 { |
|
224 TVerdict result = EFail ; |
|
225 TInt theErr = KErrNone; |
|
226 TInt theErr1 = KErrNone; |
|
227 |
|
228 __MM_HEAP_MARK; |
|
229 TInt err = RFbsSession::Connect(); |
|
230 if (err != KErrNone) |
|
231 { |
|
232 INFO_PRINTF2(_L("RFbsSession::Connect() failed, err = %d"), err); |
|
233 return EInconclusive; |
|
234 } |
|
235 |
|
236 TRAP(theErr1, theErr = EncodeImageFromBitmapToFileL(iFileNameSrc, iImageTypeUid)); |
|
237 |
|
238 RFbsSession::Disconnect(); |
|
239 |
|
240 __MM_HEAP_MARKEND; |
|
241 |
|
242 if(theErr1 != KErrNone) |
|
243 theErr = theErr1; |
|
244 |
|
245 if(theErr == KErrNone) |
|
246 { |
|
247 result = EPass; |
|
248 } |
|
249 else |
|
250 INFO_PRINTF2(_L("Error : %d"), theErr); |
|
251 |
|
252 return result; |
|
253 } |
|
254 |
|
255 /** |
|
256 * |
|
257 * Encode an image from memory to |
|
258 * a file using minimum parameters |
|
259 * |
|
260 */ |
|
261 TVerdict CTestPositiveConversion::Step0200_CP() |
|
262 { |
|
263 TInt err = KErrNone; |
|
264 TInt err2 = KErrNone; |
|
265 |
|
266 // BMP |
|
267 __MM_HEAP_MARK; |
|
268 err = RFbsSession::Connect(); |
|
269 if (err != KErrNone) |
|
270 { |
|
271 INFO_PRINTF2(_L("RFbsSession::Connect() failed, err = %d"), err); |
|
272 return EInconclusive; |
|
273 } |
|
274 |
|
275 iImageTypeUid = KImageTypeBMPUid; |
|
276 TRAP(err, err2 = EncodeImageWithMinParamsL(iFileNameSrc, iImageTypeUid)); |
|
277 if (err != KErrNone || err2 != KErrNone) |
|
278 { |
|
279 INFO_PRINTF3(_L("BMP EncodeImageWithMinParamsL failed, err = %d, err2 = %d"), err, err2); |
|
280 return EFail; |
|
281 } |
|
282 |
|
283 RFbsSession::Disconnect(); |
|
284 |
|
285 __MM_HEAP_MARKEND; |
|
286 INFO_PRINTF1(_L("BMP encode successful")); |
|
287 |
|
288 // GIF |
|
289 __MM_HEAP_MARK; |
|
290 err = RFbsSession::Connect(); |
|
291 if (err != KErrNone) |
|
292 { |
|
293 INFO_PRINTF2(_L("RFbsSession::Connect() failed, err = %d"), err); |
|
294 return EInconclusive; |
|
295 } |
|
296 |
|
297 iImageTypeUid = KImageTypeGIFUid; |
|
298 TRAP(err, err2 = EncodeImageWithMinParamsL(iFileNameSrc, iImageTypeUid)); |
|
299 if (err != KErrNone || err2 != KErrNone) |
|
300 { |
|
301 INFO_PRINTF3(_L("GIF EncodeImageWithMinParamsL failed, err = %d, err2 = %d"), err, err2); |
|
302 return EFail; |
|
303 } |
|
304 |
|
305 RFbsSession::Disconnect(); |
|
306 |
|
307 __MM_HEAP_MARKEND; |
|
308 INFO_PRINTF1(_L("GIF encode successful")); |
|
309 |
|
310 // JPEG |
|
311 __MM_HEAP_MARK; |
|
312 err = RFbsSession::Connect(); |
|
313 if (err != KErrNone) |
|
314 { |
|
315 INFO_PRINTF2(_L("RFbsSession::Connect() failed, err = %d"), err); |
|
316 return EInconclusive; |
|
317 } |
|
318 |
|
319 iImageTypeUid = KImageTypeJPGUid; |
|
320 TRAP(err, err2 = EncodeImageWithMinParamsL(iFileNameSrc, iImageTypeUid)); |
|
321 if (err != KErrNone || err2 != KErrNone) |
|
322 { |
|
323 INFO_PRINTF3(_L("JPEG EncodeImageWithMinParamsL failed, err = %d, err2 = %d"), err, err2); |
|
324 return EFail; |
|
325 } |
|
326 |
|
327 RFbsSession::Disconnect(); |
|
328 |
|
329 __MM_HEAP_MARKEND; |
|
330 INFO_PRINTF1(_L("JPEG encode successful")); |
|
331 |
|
332 // MBM |
|
333 __MM_HEAP_MARK; |
|
334 err = RFbsSession::Connect(); |
|
335 if (err != KErrNone) |
|
336 { |
|
337 INFO_PRINTF2(_L("RFbsSession::Connect() failed, err = %d"), err); |
|
338 return EInconclusive; |
|
339 } |
|
340 |
|
341 iImageTypeUid = KImageTypeMBMUid; |
|
342 TRAP(err, err2 = EncodeImageWithMinParamsL(iFileNameSrc, iImageTypeUid)); |
|
343 if (err != KErrNone || err2 != KErrNone) |
|
344 { |
|
345 INFO_PRINTF3(_L("MBM EncodeImageWithMinParamsL failed, err = %d, err2 = %d"), err, err2); |
|
346 return EFail; |
|
347 } |
|
348 |
|
349 RFbsSession::Disconnect(); |
|
350 |
|
351 __MM_HEAP_MARKEND; |
|
352 INFO_PRINTF1(_L("MBM encode successful")); |
|
353 |
|
354 // PNG |
|
355 __MM_HEAP_MARK; |
|
356 err = RFbsSession::Connect(); |
|
357 if (err != KErrNone) |
|
358 { |
|
359 INFO_PRINTF2(_L("RFbsSession::Connect() failed, err = %d"), err); |
|
360 return EInconclusive; |
|
361 } |
|
362 |
|
363 iImageTypeUid = KImageTypePNGUid; |
|
364 TRAP(err, err2 = EncodeImageWithMinParamsL(iFileNameSrc, iImageTypeUid)); |
|
365 if (err != KErrNone || err2 != KErrNone) |
|
366 { |
|
367 INFO_PRINTF3(_L("PNG EncodeImageWithMinParamsL failed, err = %d, err2 = %d"), err, err2); |
|
368 return EFail; |
|
369 } |
|
370 |
|
371 RFbsSession::Disconnect(); |
|
372 |
|
373 __MM_HEAP_MARKEND; |
|
374 INFO_PRINTF1(_L("PNG encode successful")); |
|
375 |
|
376 return EPass; |
|
377 } |
|
378 |
|
379 TInt CTestPositiveConversion::EncodeImageWithMinParamsL(const TDesC& aFilename, TUid aImageTypeId) |
|
380 { |
|
381 // Tests call to Convert with minimum parameters, allowing default params to be used. |
|
382 // |
|
383 TFileName theSourceFile; |
|
384 Directory(EReference, theSourceFile); |
|
385 theSourceFile.Append(aFilename); |
|
386 |
|
387 CFbsBitmap *theBitmap = new(ELeave) CFbsBitmap; |
|
388 TInt theRes = theBitmap->Load(theSourceFile); |
|
389 |
|
390 if(theRes != KErrNone) |
|
391 { |
|
392 delete theBitmap; |
|
393 theBitmap = NULL; |
|
394 |
|
395 ERR_PRINTF2(_L("File %S cannot be louded" ), &theSourceFile); |
|
396 return theRes; |
|
397 } |
|
398 User::LeaveIfError(iFs.Connect()); |
|
399 |
|
400 // call for a convertor |
|
401 TFileName theDestinationFileName; |
|
402 TBuf<KLenBuffer> theExtinsion; |
|
403 |
|
404 Directory(EOutput, theDestinationFileName); |
|
405 theDestinationFileName.Append(aFilename.Left(aFilename.Length()-3)); |
|
406 |
|
407 GetImageExtension(aImageTypeId, theExtinsion); |
|
408 theDestinationFileName.Append(theExtinsion); |
|
409 |
|
410 TRAP(theRes, iImageEncoder = CImageEncoder::FileNewL(iFs, |
|
411 theDestinationFileName, |
|
412 CImageEncoder::EOptionNone, |
|
413 aImageTypeId)); |
|
414 |
|
415 if(theRes != KErrNone) |
|
416 { |
|
417 delete theBitmap; |
|
418 theBitmap = NULL; |
|
419 |
|
420 iFs.Close(); |
|
421 ERR_PRINTF3(_L("Error during creating Image Encoder UId %d to file %S" ), aImageTypeId, &theDestinationFileName); |
|
422 if(KErrPathNotFound == theRes) |
|
423 ERR_PRINTF2(_L("Path %S not found" ), &theDestinationFileName); |
|
424 |
|
425 if(theRes == KErrAccessDenied) |
|
426 ERR_PRINTF1(_L("Access denied" )); |
|
427 |
|
428 return theRes; |
|
429 } |
|
430 |
|
431 //prepare encode data |
|
432 // TO DO |
|
433 // Do we really need TConvertInfo here? Need some investigation to decide whether |
|
434 // to use or delete it |
|
435 // |
|
436 // TConvertInfo theConvInfo; |
|
437 // theConvInfo.iImageTypeId = iImageTypeUid; |
|
438 // theConvInfo.iDisplayMode = theBitmap->DisplayMode(); |
|
439 |
|
440 // do conversion |
|
441 CActiveListener* activeListener = new(ELeave)CActiveListener; |
|
442 CleanupStack::PushL( activeListener ); |
|
443 |
|
444 iActiveScheduler->SetEncoder(iImageEncoder, activeListener, 0); |
|
445 iActiveScheduler->SetStep(this); |
|
446 |
|
447 activeListener->InitialiseActiveListener(); |
|
448 iImageEncoder->Convert(&activeListener->iStatus, *theBitmap); |
|
449 CActiveScheduler::Start(); |
|
450 |
|
451 |
|
452 theRes = activeListener->iStatus.Int(); |
|
453 iActiveScheduler->SetStep(NULL); |
|
454 |
|
455 //delete all local value |
|
456 delete iImageEncoder; |
|
457 iImageEncoder = NULL; |
|
458 |
|
459 delete theBitmap; |
|
460 theBitmap = NULL; |
|
461 |
|
462 CleanupStack::PopAndDestroy(1); //active sheduler |
|
463 |
|
464 if(theRes != KErrNone) |
|
465 { |
|
466 ERR_PRINTF1(_L("Error during conversion" )); |
|
467 return theRes; |
|
468 } |
|
469 else |
|
470 { |
|
471 ERR_PRINTF1(_L("Conversion was successful" )); |
|
472 } |
|
473 |
|
474 iFs.Close(); |
|
475 |
|
476 return theRes; |
|
477 } |
|
478 |
|
479 /** |
|
480 * |
|
481 * Read and decode an image from a |
|
482 * a descriptor |
|
483 * |
|
484 */ |
|
485 TVerdict CTestPositiveConversion::Step0016_CP() |
|
486 { |
|
487 TVerdict result = EFail ; |
|
488 TInt theErr = KErrNone; |
|
489 TInt theErr1 = KErrNone; |
|
490 |
|
491 __MM_HEAP_MARK; |
|
492 TInt err = RFbsSession::Connect(); |
|
493 if (err != KErrNone) |
|
494 { |
|
495 INFO_PRINTF2(_L("RFbsSession::Connect() failed, err = %d"), err); |
|
496 return EInconclusive; |
|
497 } |
|
498 |
|
499 TRAP(theErr1, theErr = OpenImageForDecodeFromBufferL(iFileNameSrc)); |
|
500 |
|
501 RFbsSession::Disconnect(); |
|
502 |
|
503 __MM_HEAP_MARKEND; |
|
504 |
|
505 if(theErr1 != KErrNone) |
|
506 theErr = theErr1; |
|
507 |
|
508 if(theErr == KErrNone) |
|
509 { |
|
510 result = EPass; |
|
511 } |
|
512 else |
|
513 INFO_PRINTF2(_L("Error : %d"), theErr); |
|
514 |
|
515 |
|
516 return result; |
|
517 } |
|
518 |
|
519 /** |
|
520 * |
|
521 * Read and decode an image incrementally |
|
522 * |
|
523 */ |
|
524 TVerdict CTestPositiveConversion::Step0017_CP() |
|
525 { |
|
526 TVerdict result = EFail ; |
|
527 TInt theErr = KErrNone; |
|
528 TInt theErr1 = KErrNone; |
|
529 |
|
530 __MM_HEAP_MARK; |
|
531 TInt err = RFbsSession::Connect(); |
|
532 if (err != KErrNone) |
|
533 { |
|
534 INFO_PRINTF2(_L("RFbsSession::Connect() failed, err = %d"), err); |
|
535 return EInconclusive; |
|
536 } |
|
537 |
|
538 TRAP(theErr1, theErr = ReadAndDecodeIncrementallyL(iFileNameSrc)); |
|
539 |
|
540 RFbsSession::Disconnect(); |
|
541 |
|
542 __MM_HEAP_MARKEND; |
|
543 |
|
544 if(theErr1 != KErrNone) |
|
545 theErr = theErr1; |
|
546 |
|
547 if(theErr == KErrNone) |
|
548 { |
|
549 result = EPass; |
|
550 } |
|
551 else |
|
552 INFO_PRINTF2(_L("Error : %d"), theErr); |
|
553 |
|
554 |
|
555 return result; |
|
556 |
|
557 } |
|
558 |
|
559 //------- |
|
560 /** |
|
561 * |
|
562 * List available decoder MIME types |
|
563 * |
|
564 */ |
|
565 TVerdict CTestPositiveConversion::Step0101_LP() |
|
566 { |
|
567 TVerdict result = EFail ; |
|
568 TInt theErr; |
|
569 |
|
570 __MM_HEAP_MARK; |
|
571 TInt err = RFbsSession::Connect(); |
|
572 if (err != KErrNone) |
|
573 { |
|
574 INFO_PRINTF2(_L("RFbsSession::Connect() failed, err = %d"), err); |
|
575 return EInconclusive; |
|
576 } |
|
577 |
|
578 theErr = ListAvailableMIMEDecoders(); |
|
579 |
|
580 RFbsSession::Disconnect(); |
|
581 |
|
582 __MM_HEAP_MARKEND; |
|
583 |
|
584 if(theErr == KErrNone) |
|
585 { |
|
586 result = EPass; |
|
587 } |
|
588 else |
|
589 INFO_PRINTF2(_L("List of decoders MIME types is not available,Error : %d"), theErr); |
|
590 |
|
591 return result; |
|
592 } |
|
593 |
|
594 /** |
|
595 * |
|
596 * List available decoders |
|
597 * |
|
598 */ |
|
599 TVerdict CTestPositiveConversion::Step0102_LP() |
|
600 { |
|
601 TVerdict result = EFail ; |
|
602 TInt theErr; |
|
603 |
|
604 __MM_HEAP_MARK; |
|
605 TInt err = RFbsSession::Connect(); |
|
606 if (err != KErrNone) |
|
607 { |
|
608 INFO_PRINTF2(_L("RFbsSession::Connect() failed, err = %d"), err); |
|
609 return EInconclusive; |
|
610 } |
|
611 |
|
612 theErr = ListAllAvailableDecoders(); |
|
613 |
|
614 RFbsSession::Disconnect(); |
|
615 |
|
616 __MM_HEAP_MARKEND; |
|
617 |
|
618 if(theErr == KErrNone) |
|
619 { |
|
620 result = EPass; |
|
621 } |
|
622 else |
|
623 INFO_PRINTF2(_L("List of decoders is not available,Error : %d"), theErr); |
|
624 |
|
625 return result; |
|
626 } |
|
627 |
|
628 /** |
|
629 * |
|
630 * List available encoder MIME types |
|
631 * |
|
632 */ |
|
633 TVerdict CTestPositiveConversion::Step0103_LP() |
|
634 { |
|
635 TVerdict result = EFail ; |
|
636 TInt theErr; |
|
637 |
|
638 __MM_HEAP_MARK; |
|
639 TInt err = RFbsSession::Connect(); |
|
640 if (err != KErrNone) |
|
641 { |
|
642 INFO_PRINTF2(_L("RFbsSession::Connect() failed, err = %d"), err); |
|
643 return EInconclusive; |
|
644 } |
|
645 |
|
646 theErr = ListAvailableMIMEEncoders(); |
|
647 |
|
648 RFbsSession::Disconnect(); |
|
649 |
|
650 __MM_HEAP_MARKEND; |
|
651 |
|
652 if(theErr == KErrNone) |
|
653 { |
|
654 result = EPass; |
|
655 } |
|
656 else |
|
657 INFO_PRINTF2(_L("List of encoders MIME types is not available, Error : %d"), theErr); |
|
658 |
|
659 return result; |
|
660 } |
|
661 |
|
662 /** |
|
663 * |
|
664 * List available encoders |
|
665 * |
|
666 */ |
|
667 TVerdict CTestPositiveConversion::Step0104_LP() |
|
668 { |
|
669 TVerdict result = EFail ; |
|
670 TInt theErr; |
|
671 |
|
672 __MM_HEAP_MARK; |
|
673 TInt err = RFbsSession::Connect(); |
|
674 if (err != KErrNone) |
|
675 { |
|
676 INFO_PRINTF2(_L("RFbsSession::Connect() failed, err = %d"), err); |
|
677 return EInconclusive; |
|
678 } |
|
679 |
|
680 theErr = ListAllAvailableEncoders(); |
|
681 |
|
682 RFbsSession::Disconnect(); |
|
683 |
|
684 __MM_HEAP_MARKEND; |
|
685 |
|
686 |
|
687 if(theErr == KErrNone) |
|
688 { |
|
689 result = EPass; |
|
690 } |
|
691 else |
|
692 INFO_PRINTF2(_L("List of encoders is not available, Error : %d"), theErr); |
|
693 return result; |
|
694 } |
|
695 |
|
696 /** |
|
697 * |
|
698 * Enquire MIME type of an unopened image |
|
699 * |
|
700 */ |
|
701 TVerdict CTestPositiveConversion::Step0105_LP() |
|
702 { |
|
703 TVerdict result = EFail ; |
|
704 TInt theErr = KErrNone; |
|
705 |
|
706 __MM_HEAP_MARK; |
|
707 TInt err = RFbsSession::Connect(); |
|
708 if (err != KErrNone) |
|
709 { |
|
710 INFO_PRINTF2(_L("RFbsSession::Connect() failed, err = %d"), err); |
|
711 return EInconclusive; |
|
712 } |
|
713 |
|
714 TRAPD(theErr1, theErr = FindMimeTypeL(iFileNameSrc)); |
|
715 |
|
716 RFbsSession::Disconnect(); |
|
717 |
|
718 __MM_HEAP_MARKEND; |
|
719 |
|
720 if(theErr1 != KErrNone) |
|
721 theErr = theErr1; |
|
722 |
|
723 if(theErr == KErrNone) |
|
724 { |
|
725 result = EPass; |
|
726 } |
|
727 else |
|
728 INFO_PRINTF2(_L("MIME type of an unopened image is not available, Error : %d"), theErr); |
|
729 return result; |
|
730 } |
|
731 |
|
732 /** |
|
733 * |
|
734 * Enquire UID of a loaded decoder |
|
735 * |
|
736 */ |
|
737 TVerdict CTestPositiveConversion::Step0106_HP() |
|
738 { |
|
739 TVerdict result = EFail ; |
|
740 TInt theErr = KErrNone; |
|
741 |
|
742 __MM_HEAP_MARK; |
|
743 TInt err = RFbsSession::Connect(); |
|
744 if (err != KErrNone) |
|
745 { |
|
746 INFO_PRINTF2(_L("RFbsSession::Connect() failed, err = %d"), err); |
|
747 return EInconclusive; |
|
748 } |
|
749 |
|
750 TRAPD(theErr1, theErr = EnquireDecoderUIDAndImplementationInfoL(iFileNameSrc)); |
|
751 |
|
752 RFbsSession::Disconnect(); |
|
753 |
|
754 __MM_HEAP_MARKEND; |
|
755 |
|
756 if(theErr1 != KErrNone) |
|
757 theErr = theErr1; |
|
758 |
|
759 if(theErr == KErrNone) |
|
760 { |
|
761 result = EPass; |
|
762 } |
|
763 else |
|
764 INFO_PRINTF2(_L("UID of a loaded decoder is not available, Error : %d"), theErr); |
|
765 return result; |
|
766 } |
|
767 |
|
768 /** |
|
769 * |
|
770 * Enquire UID of a loaded encoder |
|
771 * |
|
772 */ |
|
773 TVerdict CTestPositiveConversion::Step0107_HP() |
|
774 { |
|
775 TVerdict result = EFail ; |
|
776 TInt theErr = KErrNone; |
|
777 |
|
778 __MM_HEAP_MARK; |
|
779 TInt err = RFbsSession::Connect(); |
|
780 if (err != KErrNone) |
|
781 { |
|
782 INFO_PRINTF2(_L("RFbsSession::Connect() failed, err = %d"), err); |
|
783 return EInconclusive; |
|
784 } |
|
785 |
|
786 TRAPD(theErr1, theErr = EnquireEncoderUIDL(iFileNameSrc, iImageTypeUid)); |
|
787 |
|
788 RFbsSession::Disconnect(); |
|
789 |
|
790 __MM_HEAP_MARKEND; |
|
791 |
|
792 if(theErr1 != KErrNone) |
|
793 theErr = theErr1; |
|
794 |
|
795 if(theErr == KErrNone) |
|
796 { |
|
797 result = EPass; |
|
798 } |
|
799 else |
|
800 INFO_PRINTF2(_L("UID of a loaded encoder is not available, Error : %d"), theErr); |
|
801 return result; |
|
802 } |
|
803 |
|
804 //----- |
|
805 /** |
|
806 * |
|
807 * Request number of frames from a loaded image |
|
808 * |
|
809 */ |
|
810 TVerdict CTestPositiveConversion::Step0109_HP() |
|
811 { |
|
812 TVerdict result = EFail ; |
|
813 TInt theErr = KErrNone; |
|
814 |
|
815 __MM_HEAP_MARK; |
|
816 TInt err = RFbsSession::Connect(); |
|
817 if (err != KErrNone) |
|
818 { |
|
819 INFO_PRINTF2(_L("RFbsSession::Connect() failed, err = %d"), err); |
|
820 return EInconclusive; |
|
821 } |
|
822 |
|
823 TRAPD(theErr1, theErr = RequestNumberFramesL(iFileNameSrc)); |
|
824 |
|
825 RFbsSession::Disconnect(); |
|
826 |
|
827 __MM_HEAP_MARKEND; |
|
828 |
|
829 if(theErr1 != KErrNone) |
|
830 theErr = theErr1; |
|
831 |
|
832 if(theErr == KErrNone) |
|
833 { |
|
834 result = EPass; |
|
835 } |
|
836 else |
|
837 INFO_PRINTF2(_L("Number of frame is not available, Error : %d"), theErr); |
|
838 return result; |
|
839 } |
|
840 |
|
841 /** |
|
842 * |
|
843 * Request frame information for frames in a loaded image |
|
844 * |
|
845 */ |
|
846 TVerdict CTestPositiveConversion::Step0110_HP() |
|
847 { |
|
848 TVerdict result = EFail ; |
|
849 TInt theErr = KErrNone; |
|
850 |
|
851 __MM_HEAP_MARK; |
|
852 TInt err = RFbsSession::Connect(); |
|
853 if (err != KErrNone) |
|
854 { |
|
855 INFO_PRINTF2(_L("RFbsSession::Connect() failed, err = %d"), err); |
|
856 return EInconclusive; |
|
857 } |
|
858 |
|
859 TRAPD(theErr1, theErr = RequestDecodeDataL(iFileNameSrc, KShowFrameInformation)); |
|
860 |
|
861 RFbsSession::Disconnect(); |
|
862 |
|
863 __MM_HEAP_MARKEND; |
|
864 |
|
865 if(theErr1 != KErrNone) |
|
866 theErr = theErr1; |
|
867 |
|
868 if(theErr == KErrNone) |
|
869 { |
|
870 result = EPass; |
|
871 } |
|
872 else |
|
873 INFO_PRINTF2(_L("Number of frame is not available, Error : %d"), theErr); |
|
874 return result; |
|
875 } |
|
876 |
|
877 /** |
|
878 * |
|
879 * Request decode options for frames in a loaded image |
|
880 * |
|
881 */ |
|
882 TVerdict CTestPositiveConversion::Step0111_HP() |
|
883 { |
|
884 TVerdict result = EFail ; |
|
885 TInt theErr = KErrNone; |
|
886 |
|
887 __MM_HEAP_MARK; |
|
888 TInt err = RFbsSession::Connect(); |
|
889 if (err != KErrNone) |
|
890 { |
|
891 INFO_PRINTF2(_L("RFbsSession::Connect() failed, err = %d"), err); |
|
892 return EInconclusive; |
|
893 } |
|
894 |
|
895 TRAPD(theErr1, theErr = RequestDecodeDataL(iFileNameSrc, KShowFrameOption)); |
|
896 |
|
897 RFbsSession::Disconnect(); |
|
898 |
|
899 __MM_HEAP_MARKEND; |
|
900 |
|
901 if(theErr1 != KErrNone) |
|
902 theErr = theErr1; |
|
903 |
|
904 if(theErr == KErrNone) |
|
905 { |
|
906 result = EPass; |
|
907 } |
|
908 else |
|
909 INFO_PRINTF2(_L("decode options for frames are not available, Error : %d"), theErr); |
|
910 return result; |
|
911 |
|
912 } |
|
913 |
|
914 /** |
|
915 * |
|
916 * Request frame information for frames |
|
917 * in an animated GIF |
|
918 * |
|
919 */ |
|
920 TVerdict CTestPositiveConversion::Step0112_HP() |
|
921 { |
|
922 TVerdict result = EFail ; |
|
923 TInt theErr = KErrNone; |
|
924 |
|
925 __MM_HEAP_MARK; |
|
926 TInt err = RFbsSession::Connect(); |
|
927 if (err != KErrNone) |
|
928 { |
|
929 INFO_PRINTF2(_L("RFbsSession::Connect() failed, err = %d"), err); |
|
930 return EInconclusive; |
|
931 } |
|
932 |
|
933 TRAPD(theErr1, theErr = RequestDecodeDataL(iFileNameSrc, KShowFrameOption | KShowFrameInformation)); |
|
934 |
|
935 RFbsSession::Disconnect(); |
|
936 |
|
937 __MM_HEAP_MARKEND; |
|
938 |
|
939 if(theErr1 != KErrNone) |
|
940 theErr = theErr1; |
|
941 |
|
942 if(theErr == KErrNone) |
|
943 { |
|
944 INFO_PRINTF1(_L("frame information is sufficiently complete to define an animated GIF")); |
|
945 result = EPass; |
|
946 } |
|
947 else |
|
948 INFO_PRINTF2(_L("frame information is not available, Error : %d"), theErr); |
|
949 return result; |
|
950 } |
|
951 |
|
952 /** |
|
953 * |
|
954 * Encode an image specifying extra |
|
955 * encode parameters |
|
956 * |
|
957 */ |
|
958 TVerdict CTestPositiveConversion::Step0113_CP() |
|
959 { |
|
960 TVerdict result = EFail ; |
|
961 TInt theErr = KErrNone; |
|
962 |
|
963 __MM_HEAP_MARK; |
|
964 TInt err = RFbsSession::Connect(); |
|
965 if (err != KErrNone) |
|
966 { |
|
967 INFO_PRINTF2(_L("RFbsSession::Connect() failed, err = %d"), err); |
|
968 return EInconclusive; |
|
969 } |
|
970 |
|
971 TRAPD(theErr1, theErr = EncodeImageToMemoryL(iFileNameSrc, iImageTypeUid)); |
|
972 |
|
973 RFbsSession::Disconnect(); |
|
974 |
|
975 __MM_HEAP_MARKEND; |
|
976 |
|
977 if(theErr1 != KErrNone) |
|
978 theErr = theErr1; |
|
979 |
|
980 if(theErr == KErrNone) |
|
981 { |
|
982 result = EPass; |
|
983 } |
|
984 else |
|
985 INFO_PRINTF2(_L("Error during encode an image specifying extra parameters, Error : %d"), theErr); |
|
986 return result; |
|
987 |
|
988 } |
|
989 |
|
990 /** |
|
991 * |
|
992 * Open image and retrieve embedded image comments |
|
993 * |
|
994 */ |
|
995 TVerdict CTestPositiveConversion::Step0114_HP() |
|
996 { |
|
997 TVerdict result = EFail ; |
|
998 TInt theErr = KErrNone; |
|
999 |
|
1000 __MM_HEAP_MARK; |
|
1001 TInt err = RFbsSession::Connect(); |
|
1002 if (err != KErrNone) |
|
1003 { |
|
1004 INFO_PRINTF2(_L("RFbsSession::Connect() failed, err = %d"), err); |
|
1005 return EInconclusive; |
|
1006 } |
|
1007 |
|
1008 TRAPD(theErr1, theErr = RetrieveEmbeddedCommentsL(iFileNameSrc)); |
|
1009 |
|
1010 RFbsSession::Disconnect(); |
|
1011 |
|
1012 __MM_HEAP_MARKEND; |
|
1013 |
|
1014 if(theErr1 != KErrNone) |
|
1015 theErr = theErr1; |
|
1016 |
|
1017 if(theErr == KErrNone) |
|
1018 { |
|
1019 result = EPass; |
|
1020 } |
|
1021 else |
|
1022 INFO_PRINTF2(_L("Error during retrieving embedded image comments, Error : %d"), theErr); |
|
1023 return result; |
|
1024 |
|
1025 } |
|
1026 |
|
1027 /** |
|
1028 * |
|
1029 * Open image and retrieve frame info |
|
1030 * |
|
1031 */ |
|
1032 TVerdict CTestPositiveConversion::Step0115_HP() |
|
1033 { |
|
1034 TVerdict result = EFail ; |
|
1035 TInt theErr = KErrNone; |
|
1036 |
|
1037 __MM_HEAP_MARK; |
|
1038 TInt err = RFbsSession::Connect(); |
|
1039 if (err != KErrNone) |
|
1040 { |
|
1041 INFO_PRINTF2(_L("RFbsSession::Connect() failed, err = %d"), err); |
|
1042 return EInconclusive; |
|
1043 } |
|
1044 |
|
1045 TRAPD(theErr1, theErr = RetrieveFrameInfoL(iFileNameSrc)); |
|
1046 |
|
1047 RFbsSession::Disconnect(); |
|
1048 |
|
1049 __MM_HEAP_MARKEND; |
|
1050 |
|
1051 if(theErr1 != KErrNone) |
|
1052 theErr = theErr1; |
|
1053 |
|
1054 if(theErr == KErrNone) |
|
1055 { |
|
1056 result = EPass; |
|
1057 } |
|
1058 else |
|
1059 INFO_PRINTF2(_L("Error during retrieving frame info, Error : %d"), theErr); |
|
1060 return result; |
|
1061 |
|
1062 } |
|
1063 |
|
1064 |
|
1065 /** |
|
1066 PDEF117879 : ICL unable to load MBM |
|
1067 |
|
1068 Test description: Attempt to decode frame 8 from a buffer source (read from |
|
1069 mbm_datanewl_0300.uic) and save this to a file. File is compared with the |
|
1070 reference image mbm_datanewl_0300.mbm. |
|
1071 |
|
1072 The input image has an extension .uic (although it is an .mbm) in order to |
|
1073 force ICL to recognise the correct codec plugin. |
|
1074 |
|
1075 The input file contains a mixture of colour-depths and compression levels, |
|
1076 which results in frame #8 (12bpp compressed) falling in between a half-word |
|
1077 boundary. |
|
1078 |
|
1079 Uses OpenBufferedImage() |
|
1080 */ |
|
1081 TVerdict CTestPositiveConversion::Step0300_HP() |
|
1082 { |
|
1083 TVerdict result = EFail; |
|
1084 |
|
1085 __MM_HEAP_MARK; |
|
1086 TInt err = RFbsSession::Connect(); |
|
1087 if(err != KErrNone) |
|
1088 { |
|
1089 INFO_PRINTF2(_L("RFbsSession::Connect() failed, err = %d"), err); |
|
1090 return EInconclusive; |
|
1091 } |
|
1092 |
|
1093 TRAP(err, OpenBufferedImageL(iFileNameSrc, 8)); // decode 8th frame |
|
1094 |
|
1095 RFbsSession::Disconnect(); |
|
1096 |
|
1097 __MM_HEAP_MARKEND; |
|
1098 |
|
1099 if(err == KErrNone) |
|
1100 { |
|
1101 result = EPass; |
|
1102 } |
|
1103 else |
|
1104 { |
|
1105 INFO_PRINTF2(_L("Error : %d"), err); |
|
1106 } |
|
1107 |
|
1108 return result; |
|
1109 } |
|
1110 |
|
1111 |
|
1112 /** |
|
1113 * |
|
1114 * Read and Decoder using FileNewL with DRM intent API |
|
1115 * |
|
1116 * Step 0600_HP |
|
1117 * |
|
1118 */ |
|
1119 TVerdict CTestPositiveConversion::Step0600_HP() |
|
1120 { |
|
1121 TVerdict result = EFail; |
|
1122 TInt err = KErrNone; |
|
1123 |
|
1124 // dummy Hal call for heap balance on target |
|
1125 if (DummyHalCall() != KErrNone) |
|
1126 return EInconclusive; |
|
1127 |
|
1128 __MM_HEAP_MARK; |
|
1129 err = RFbsSession::Connect(); |
|
1130 if (err != KErrNone) |
|
1131 { |
|
1132 INFO_PRINTF2(_L("RFbsSession::Connect() failed, err = %d"), err); |
|
1133 return EInconclusive; |
|
1134 } |
|
1135 |
|
1136 TRAP(err, OpenImageForDecodeFromFileWithIntentL(iFileNameSrc, EView)); |
|
1137 |
|
1138 RFbsSession::Disconnect(); |
|
1139 |
|
1140 __MM_HEAP_MARKEND; |
|
1141 |
|
1142 if(err == KErrNone) |
|
1143 { |
|
1144 result = EPass; |
|
1145 } |
|
1146 else |
|
1147 INFO_PRINTF2(_L("Error : %d"), err); |
|
1148 |
|
1149 return result; |
|
1150 } |
|
1151 |
|
1152 /** |
|
1153 * |
|
1154 * Read and Decoder using FileNewL with DRM intent API |
|
1155 * |
|
1156 * Step 0601_HP |
|
1157 * |
|
1158 */ |
|
1159 TVerdict CTestPositiveConversion::Step0601_HP() |
|
1160 { |
|
1161 TVerdict result = EFail ; |
|
1162 TInt err = KErrNone; |
|
1163 |
|
1164 // dummy Hal call for heap balance on target |
|
1165 if (DummyHalCall() != KErrNone) |
|
1166 return EInconclusive; |
|
1167 |
|
1168 __MM_HEAP_MARK; |
|
1169 err = RFbsSession::Connect(); |
|
1170 if (err != KErrNone) |
|
1171 { |
|
1172 INFO_PRINTF2(_L("RFbsSession::Connect() failed, err = %d"), err); |
|
1173 return EInconclusive; |
|
1174 } |
|
1175 |
|
1176 TBuf8<KMaxMimeLength> mimeType; |
|
1177 ReadMimeTypeFromConfig(mimeType); |
|
1178 |
|
1179 TRAP(err, OpenImageForDecodeFromFileWithIntentL(iFileNameSrc, EView, mimeType)); |
|
1180 |
|
1181 RFbsSession::Disconnect(); |
|
1182 |
|
1183 __MM_HEAP_MARKEND; |
|
1184 |
|
1185 if(err == KErrNone) |
|
1186 { |
|
1187 result = EPass; |
|
1188 } |
|
1189 else |
|
1190 INFO_PRINTF2(_L("Error : %d"), err); |
|
1191 |
|
1192 return result; |
|
1193 } |
|
1194 |
|
1195 |
|
1196 |
|
1197 /** |
|
1198 * |
|
1199 * Read and Decode DRM protected Image using FileNewL with DRM intent API |
|
1200 * |
|
1201 * Step 0608_HP |
|
1202 * |
|
1203 */ |
|
1204 TVerdict CTestPositiveConversion::Step0608_HP() |
|
1205 { |
|
1206 TVerdict result = EFail ; |
|
1207 TInt err = KErrNone; |
|
1208 |
|
1209 // dummy Hal call for heap balance on target |
|
1210 if (DummyHalCall() != KErrNone) |
|
1211 return EInconclusive; |
|
1212 |
|
1213 __MM_HEAP_MARK; |
|
1214 err = RFbsSession::Connect(); |
|
1215 if (err != KErrNone) |
|
1216 { |
|
1217 INFO_PRINTF2(_L("RFbsSession::Connect() failed, err = %d"), err); |
|
1218 return EInconclusive; |
|
1219 } |
|
1220 |
|
1221 TRAP(err, OpenImageForDecodeFromFileWithIntentL(iFileNameSrc, EView)); |
|
1222 |
|
1223 RFbsSession::Disconnect(); |
|
1224 |
|
1225 __MM_HEAP_MARKEND; |
|
1226 |
|
1227 if(err == KErrNone) |
|
1228 { |
|
1229 result = EPass; |
|
1230 } |
|
1231 else |
|
1232 INFO_PRINTF2(_L("Error : %d"), err); |
|
1233 |
|
1234 return result; |
|
1235 } |
|
1236 |
|
1237 /** |
|
1238 * |
|
1239 * Read and Decode DRM protected Image using FileNewL with DRM intent API, specifying mime type |
|
1240 * |
|
1241 * Step 0609_HP |
|
1242 * |
|
1243 */ |
|
1244 TVerdict CTestPositiveConversion::Step0609_HP() |
|
1245 { |
|
1246 TVerdict result = EFail ; |
|
1247 TInt err = KErrNone; |
|
1248 |
|
1249 // dummy Hal call for heap balance on target |
|
1250 if (DummyHalCall() != KErrNone) |
|
1251 return EInconclusive; |
|
1252 |
|
1253 __MM_HEAP_MARK; |
|
1254 err = RFbsSession::Connect(); |
|
1255 if (err != KErrNone) |
|
1256 { |
|
1257 INFO_PRINTF2(_L("RFbsSession::Connect() failed, err = %d"), err); |
|
1258 return EInconclusive; |
|
1259 } |
|
1260 |
|
1261 TBuf8<KMaxMimeLength> mimeType; |
|
1262 ReadMimeTypeFromConfig(mimeType); |
|
1263 |
|
1264 TRAP(err, OpenImageForDecodeFromFileWithIntentL(iFileNameSrc, EView, mimeType)); |
|
1265 |
|
1266 RFbsSession::Disconnect(); |
|
1267 |
|
1268 __MM_HEAP_MARKEND; |
|
1269 |
|
1270 if(err == KErrNone) |
|
1271 { |
|
1272 result = EPass; |
|
1273 } |
|
1274 else |
|
1275 INFO_PRINTF2(_L("Error : %d"), err); |
|
1276 |
|
1277 return result; |
|
1278 } |
|
1279 |
|
1280 |
|
1281 /** |
|
1282 * |
|
1283 * Read and Decode DRM protected Image using FileNewL with DRM intent API, image type uid |
|
1284 * |
|
1285 * Step 0610_HP |
|
1286 * |
|
1287 */ |
|
1288 TVerdict CTestPositiveConversion::Step0610_HP() |
|
1289 { |
|
1290 TVerdict result = EFail ; |
|
1291 TInt err = KErrNone; |
|
1292 |
|
1293 // dummy Hal call for heap balance on target |
|
1294 if (DummyHalCall() != KErrNone) |
|
1295 return EInconclusive; |
|
1296 |
|
1297 __MM_HEAP_MARK; |
|
1298 err = RFbsSession::Connect(); |
|
1299 if (err != KErrNone) |
|
1300 { |
|
1301 INFO_PRINTF2(_L("RFbsSession::Connect() failed, err = %d"), err); |
|
1302 return EInconclusive; |
|
1303 } |
|
1304 |
|
1305 TBuf8<KMaxMimeLength> mimeType; |
|
1306 ReadMimeTypeFromConfig(mimeType); |
|
1307 |
|
1308 TRAP(err, OpenImageForDecodeFromFileWithIntentL(iFileNameSrc, EView, iImageTypeUid)); |
|
1309 |
|
1310 RFbsSession::Disconnect(); |
|
1311 |
|
1312 __MM_HEAP_MARKEND; |
|
1313 |
|
1314 if(err == KErrNone) |
|
1315 { |
|
1316 result = EPass; |
|
1317 } |
|
1318 else |
|
1319 INFO_PRINTF2(_L("Error : %d"), err); |
|
1320 |
|
1321 return result; |
|
1322 } |
|
1323 |
|
1324 /** |
|
1325 * |
|
1326 * Read and Decode DRM protected Image using FileNewL with DRM intent API, specifying plugin uid |
|
1327 * |
|
1328 * Step 0611_HP |
|
1329 * |
|
1330 */ |
|
1331 TVerdict CTestPositiveConversion::Step0611_HP() |
|
1332 { |
|
1333 TVerdict result = EFail ; |
|
1334 TInt err = KErrNone; |
|
1335 |
|
1336 // dummy Hal call for heap balance on target |
|
1337 if (DummyHalCall() != KErrNone) |
|
1338 return EInconclusive; |
|
1339 |
|
1340 __MM_HEAP_MARK; |
|
1341 err = RFbsSession::Connect(); |
|
1342 if (err != KErrNone) |
|
1343 { |
|
1344 INFO_PRINTF2(_L("RFbsSession::Connect() failed, err = %d"), err); |
|
1345 return EInconclusive; |
|
1346 } |
|
1347 |
|
1348 TUid decoderUid; |
|
1349 ReadDecoderUidFromConfig(decoderUid); |
|
1350 |
|
1351 TRAP(err, OpenImageForDecodeFromFileWithIntentL(iFileNameSrc, EView, iImageTypeUid, decoderUid)); |
|
1352 |
|
1353 RFbsSession::Disconnect(); |
|
1354 |
|
1355 __MM_HEAP_MARKEND; |
|
1356 |
|
1357 if(err == KErrNone) |
|
1358 { |
|
1359 result = EPass; |
|
1360 } |
|
1361 else |
|
1362 INFO_PRINTF2(_L("Error : %d"), err); |
|
1363 |
|
1364 return result; |
|
1365 } |
|
1366 |
|
1367 /** |
|
1368 * |
|
1369 * Read and Decode PPM protected Image using FileNewL with specifying PPM1 plugin uid and file name |
|
1370 * |
|
1371 * Step 0612_HP |
|
1372 * |
|
1373 */ |
|
1374 TVerdict CTestPositiveConversion::Step0612_HP() |
|
1375 { |
|
1376 TVerdict result = EFail ; |
|
1377 TInt theErr = KErrNone; |
|
1378 TInt theErr1 = KErrNone; |
|
1379 |
|
1380 // dummy Hal call for heap balance on target |
|
1381 if (DummyHalCall() != KErrNone) |
|
1382 return EInconclusive; |
|
1383 |
|
1384 //PPM1 |
|
1385 __MM_HEAP_MARK; |
|
1386 theErr1 = RFbsSession::Connect(); |
|
1387 if (theErr1 != KErrNone) |
|
1388 { |
|
1389 INFO_PRINTF2(_L("RFbsSession::Connect() failed, err = %d"), theErr1); |
|
1390 return EInconclusive; |
|
1391 } |
|
1392 |
|
1393 TRAP(theErr1, theErr = OpenPpmImageForDecodeFromFileL(iFileNameSrc, iImageTypeUid, TUid::Uid(KPpm1DecoderImplementationUidValue))); |
|
1394 if (theErr1 != KErrNone || theErr != KErrNone) |
|
1395 { |
|
1396 INFO_PRINTF3(_L("OpenPpmImageForDecodeFromFileL failed, err = %d, err = %d"), theErr1, theErr); |
|
1397 result = EFail; |
|
1398 } |
|
1399 |
|
1400 RFbsSession::Disconnect(); |
|
1401 |
|
1402 __MM_HEAP_MARKEND; |
|
1403 if(theErr1 != KErrNone) |
|
1404 { |
|
1405 theErr = theErr1; |
|
1406 } |
|
1407 |
|
1408 if(theErr == KErrNone) |
|
1409 { |
|
1410 INFO_PRINTF1(_L("PPM1 Codec decoding was successful with specifying Uid and file")); |
|
1411 result = EPass; |
|
1412 } |
|
1413 else |
|
1414 { |
|
1415 INFO_PRINTF2(_L("Error : %d"), theErr); |
|
1416 } |
|
1417 |
|
1418 return result; |
|
1419 } |
|
1420 |
|
1421 /** |
|
1422 * |
|
1423 * Read and Decode PPM protected Image using FileNewL with specifying PPM2 plugin uid and file name |
|
1424 * |
|
1425 * Step 0613_HP |
|
1426 * |
|
1427 */ |
|
1428 TVerdict CTestPositiveConversion::Step0613_HP() |
|
1429 { |
|
1430 TVerdict result = EFail ; |
|
1431 TInt theErr = KErrNone; |
|
1432 TInt theErr1 = KErrNone; |
|
1433 |
|
1434 // dummy Hal call for heap balance on target |
|
1435 if (DummyHalCall() != KErrNone) |
|
1436 return EInconclusive; |
|
1437 |
|
1438 //PPM2 |
|
1439 __MM_HEAP_MARK; |
|
1440 theErr1 = RFbsSession::Connect(); |
|
1441 if (theErr1 != KErrNone) |
|
1442 { |
|
1443 INFO_PRINTF2(_L("RFbsSession::Connect() failed, err = %d"), theErr1); |
|
1444 return EInconclusive; |
|
1445 } |
|
1446 |
|
1447 TRAP(theErr1, theErr = OpenPpmImageForDecodeFromFileL(iFileNameSrc, iImageTypeUid, TUid::Uid(KPpm2DecoderImplementationUidValue))); |
|
1448 if (theErr1 != KErrNone || theErr != KErrNone) |
|
1449 { |
|
1450 INFO_PRINTF3(_L("OpenPpmImageForDecodeFromFileL failed, err = %d, err = %d"), theErr1, theErr); |
|
1451 result = EFail; |
|
1452 } |
|
1453 |
|
1454 RFbsSession::Disconnect(); |
|
1455 |
|
1456 __MM_HEAP_MARKEND; |
|
1457 if(theErr1 != KErrNone) |
|
1458 { |
|
1459 theErr = theErr1; |
|
1460 } |
|
1461 |
|
1462 if(theErr == KErrNone) |
|
1463 { |
|
1464 INFO_PRINTF1(_L("PPM2 Codec decoding was successful with specifying Uid and file")); |
|
1465 result = EPass; |
|
1466 } |
|
1467 else |
|
1468 { |
|
1469 INFO_PRINTF2(_L("Error : %d"), theErr); |
|
1470 } |
|
1471 |
|
1472 return result; |
|
1473 } |
|
1474 |
|
1475 /** |
|
1476 * |
|
1477 * Read and Decode PPM protected Image using FileNewL with out specifying any plugin uid and with specifying file name only |
|
1478 * |
|
1479 * Step 0614_HP |
|
1480 * |
|
1481 */ |
|
1482 TVerdict CTestPositiveConversion::Step0614_HP() |
|
1483 { |
|
1484 TVerdict result = EFail ; |
|
1485 TInt theErr = KErrNone; |
|
1486 TInt theErr1 = KErrNone; |
|
1487 |
|
1488 // dummy Hal call for heap balance on target |
|
1489 if (DummyHalCall() != KErrNone) |
|
1490 return EInconclusive; |
|
1491 |
|
1492 //PPM |
|
1493 __MM_HEAP_MARK; |
|
1494 theErr1 = RFbsSession::Connect(); |
|
1495 if (theErr1 != KErrNone) |
|
1496 { |
|
1497 INFO_PRINTF2(_L("RFbsSession::Connect() failed, err = %d"), theErr1); |
|
1498 return EInconclusive; |
|
1499 } |
|
1500 |
|
1501 TRAP(theErr1, theErr = OpenPpmImageForDecodeFromFileL(iFileNameSrc, iImageTypeUid)); |
|
1502 if (theErr1 != KErrNone || theErr != KErrNone) |
|
1503 { |
|
1504 INFO_PRINTF3(_L("OpenPpmImageForDecodeFromFileL failed, err = %d, err = %d"), theErr1, theErr); |
|
1505 result = EFail; |
|
1506 } |
|
1507 |
|
1508 RFbsSession::Disconnect(); |
|
1509 |
|
1510 __MM_HEAP_MARKEND; |
|
1511 if(theErr1 != KErrNone) |
|
1512 { |
|
1513 theErr = theErr1; |
|
1514 } |
|
1515 |
|
1516 if(theErr == KErrNone) |
|
1517 { |
|
1518 INFO_PRINTF1(_L("PPM Codec decoding was successful with specifying file name")); |
|
1519 result = EPass; |
|
1520 } |
|
1521 else |
|
1522 { |
|
1523 INFO_PRINTF2(_L("Error : %d"), theErr); |
|
1524 } |
|
1525 |
|
1526 return result; |
|
1527 } |
|
1528 |
|
1529 |
|
1530 /** |
|
1531 * |
|
1532 * Read and Encode PPM protected Image using FileNewL with specifying PPM1 plugin uid and file name |
|
1533 * |
|
1534 * Step 0615_HP |
|
1535 * |
|
1536 */ |
|
1537 TVerdict CTestPositiveConversion::Step0615_HP() |
|
1538 { |
|
1539 TVerdict result = EFail ; |
|
1540 TInt theErr = KErrNone; |
|
1541 TInt theErr1 = KErrNone; |
|
1542 |
|
1543 // PPM1 |
|
1544 __MM_HEAP_MARK; |
|
1545 theErr = RFbsSession::Connect(); |
|
1546 if (theErr != KErrNone) |
|
1547 { |
|
1548 INFO_PRINTF2(_L("RFbsSession::Connect() failed, err = %d"), theErr); |
|
1549 return EInconclusive; |
|
1550 } |
|
1551 |
|
1552 TRAP(theErr1, theErr = EncodePpmImageParamsL(iFileNameSrc, iImageTypeUid , TUid::Uid(KPpm1EncoderImplementationUidValued))); |
|
1553 if (theErr1 != KErrNone || theErr != KErrNone) |
|
1554 { |
|
1555 INFO_PRINTF3(_L("EncodePpmImageWithMinParamsL failed with Uid, err = %d, err = %d"), theErr1, theErr); |
|
1556 result = EFail; |
|
1557 } |
|
1558 |
|
1559 RFbsSession::Disconnect(); |
|
1560 |
|
1561 __MM_HEAP_MARKEND; |
|
1562 if(theErr1 != KErrNone) |
|
1563 { |
|
1564 theErr = theErr1; |
|
1565 } |
|
1566 |
|
1567 if(theErr == KErrNone) |
|
1568 { |
|
1569 INFO_PRINTF1(_L("PPM1 Codec encoding was successful with specifying Uid")); |
|
1570 result = EPass; |
|
1571 } |
|
1572 else |
|
1573 { |
|
1574 INFO_PRINTF2(_L("Error : %d"), theErr); |
|
1575 } |
|
1576 |
|
1577 return result; |
|
1578 } |
|
1579 |
|
1580 /** |
|
1581 * |
|
1582 * Read and Encode PPM protected Image using FileNewL with specifying PPM2 plugin uid and file name |
|
1583 * |
|
1584 * Step 0616_HP |
|
1585 * |
|
1586 */ |
|
1587 TVerdict CTestPositiveConversion::Step0616_HP() |
|
1588 { |
|
1589 TVerdict result = EFail; |
|
1590 TInt theErr = KErrNone; |
|
1591 TInt theErr1 = KErrNone; |
|
1592 |
|
1593 // PPM2 |
|
1594 __MM_HEAP_MARK; |
|
1595 theErr = RFbsSession::Connect(); |
|
1596 if (theErr != KErrNone) |
|
1597 { |
|
1598 INFO_PRINTF2(_L("RFbsSession::Connect() failed, err = %d"), theErr); |
|
1599 return EInconclusive; |
|
1600 } |
|
1601 |
|
1602 TRAP(theErr1, theErr = EncodePpmImageParamsL(iFileNameSrc, iImageTypeUid, TUid::Uid(KPpm2EncoderImplementationUidValue))); |
|
1603 if (theErr1 != KErrNone || theErr != KErrNone) |
|
1604 { |
|
1605 INFO_PRINTF3(_L("EncodePpmImageWithMinParamsL failed with Uid, err = %d, err = %d"), theErr1, theErr); |
|
1606 result = EFail; |
|
1607 } |
|
1608 |
|
1609 RFbsSession::Disconnect(); |
|
1610 |
|
1611 __MM_HEAP_MARKEND; |
|
1612 if(theErr1 != KErrNone) |
|
1613 { |
|
1614 theErr = theErr1; |
|
1615 } |
|
1616 |
|
1617 if(theErr == KErrNone) |
|
1618 { |
|
1619 INFO_PRINTF1(_L("PPM2 Codec encoding was successful with specifying Uid")); |
|
1620 result = EPass; |
|
1621 } |
|
1622 else |
|
1623 { |
|
1624 INFO_PRINTF2(_L("Error : %d"), theErr); |
|
1625 } |
|
1626 |
|
1627 return result; |
|
1628 } |
|
1629 |
|
1630 /** |
|
1631 * |
|
1632 * Read and Encode PPM protected Image using FileNewL with out specifying any plugin uid and with specifying file name only |
|
1633 * |
|
1634 * Step 0617_HP |
|
1635 * |
|
1636 */ |
|
1637 TVerdict CTestPositiveConversion::Step0617_HP() |
|
1638 { |
|
1639 TVerdict result = EFail; |
|
1640 TInt theErr = KErrNone; |
|
1641 TInt theErr1 = KErrNone; |
|
1642 |
|
1643 // PPM |
|
1644 __MM_HEAP_MARK; |
|
1645 theErr = RFbsSession::Connect(); |
|
1646 if (theErr != KErrNone) |
|
1647 { |
|
1648 INFO_PRINTF2(_L("RFbsSession::Connect() failed, err = %d"), theErr); |
|
1649 return EInconclusive; |
|
1650 } |
|
1651 |
|
1652 TRAP(theErr1, theErr = EncodePpmImageParamsL(iFileNameSrc, iImageTypeUid)); |
|
1653 if (theErr != KErrNone || theErr1 != KErrNone) |
|
1654 { |
|
1655 INFO_PRINTF3(_L("EncodePpmImageWithMinParamsL failed with file, err = %d, err = %d"), theErr1, theErr); |
|
1656 result = EFail; |
|
1657 } |
|
1658 |
|
1659 RFbsSession::Disconnect(); |
|
1660 |
|
1661 __MM_HEAP_MARKEND; |
|
1662 if(theErr1 != KErrNone) |
|
1663 { |
|
1664 theErr = theErr1; |
|
1665 } |
|
1666 |
|
1667 if(theErr == KErrNone) |
|
1668 { |
|
1669 INFO_PRINTF1(_L("PPM Codec encoding was successful with specifying mime type")); |
|
1670 result = EPass; |
|
1671 } |
|
1672 else |
|
1673 { |
|
1674 INFO_PRINTF2(_L("Error : %d"), theErr); |
|
1675 } |
|
1676 |
|
1677 return result; |
|
1678 } |
|
1679 |
|
1680 TInt CTestPositiveConversion::EncodePpmImageParamsL(const TDesC& aFilename, TUid aImageTypeId, const TUid aKPpmEncoderUid) |
|
1681 { |
|
1682 // Tests call to Convert with minimum parameters, allowing default params to be used. |
|
1683 // |
|
1684 TFileName theSourceFile; |
|
1685 Directory(EReference, theSourceFile); |
|
1686 theSourceFile.Append(aFilename); |
|
1687 |
|
1688 CFbsBitmap *theBitmap = new(ELeave) CFbsBitmap; |
|
1689 CleanupStack::PushL(theBitmap); |
|
1690 TInt theRes = theBitmap->Load(theSourceFile); |
|
1691 |
|
1692 if(theRes != KErrNone) |
|
1693 { |
|
1694 CleanupStack::PopAndDestroy(theBitmap); |
|
1695 theBitmap = NULL; |
|
1696 |
|
1697 INFO_PRINTF2(_L("File %S cannot be loaded" ), &theSourceFile); |
|
1698 return theRes; |
|
1699 } |
|
1700 |
|
1701 User::LeaveIfError(iFs.Connect()); |
|
1702 |
|
1703 // call for a convertor |
|
1704 TFileName theDestinationFileName; |
|
1705 TBuf<KLenBuffer> theExtension; |
|
1706 |
|
1707 Directory(EOutput, theDestinationFileName); |
|
1708 theDestinationFileName.Append(aFilename.Left(aFilename.Length()-3)); |
|
1709 |
|
1710 GetImageExtension(aImageTypeId, theExtension); |
|
1711 theDestinationFileName.Append(theExtension); |
|
1712 |
|
1713 if( aKPpmEncoderUid == TUid::Uid(KPpm1EncoderImplementationUidValued )) |
|
1714 { |
|
1715 TRAP(theRes, iImageEncoder = CImageEncoder::FileNewL(iFs, |
|
1716 theDestinationFileName, |
|
1717 CImageEncoder::EOptionNone, |
|
1718 aImageTypeId, KNullUid,aKPpmEncoderUid)); |
|
1719 } |
|
1720 |
|
1721 else |
|
1722 if(aKPpmEncoderUid == TUid::Uid(KPpm2EncoderImplementationUidValue )) |
|
1723 { |
|
1724 TRAP(theRes, iImageEncoder = CImageEncoder::FileNewL(iFs, |
|
1725 theDestinationFileName, |
|
1726 CImageEncoder::EOptionNone, |
|
1727 aImageTypeId, KNullUid,aKPpmEncoderUid)); |
|
1728 } |
|
1729 |
|
1730 else |
|
1731 { |
|
1732 TBuf8<KMaxMimeLength> mimeType; |
|
1733 ReadMimeTypeFromConfig(mimeType); |
|
1734 TRAP(theRes, iImageEncoder = CImageEncoder::FileNewL(iFs, |
|
1735 theDestinationFileName, |
|
1736 mimeType, |
|
1737 CImageEncoder::EOptionNone)); |
|
1738 } |
|
1739 |
|
1740 if(theRes != KErrNone) |
|
1741 { |
|
1742 CleanupStack::PopAndDestroy(theBitmap); |
|
1743 theBitmap = NULL; |
|
1744 |
|
1745 iFs.Close(); |
|
1746 INFO_PRINTF3(_L("Error during creating Image Encoder UId %d to file %S" ), aImageTypeId, &theDestinationFileName); |
|
1747 if(theRes == KErrPathNotFound) |
|
1748 { |
|
1749 INFO_PRINTF2(_L("Path %S not found" ), &theDestinationFileName); |
|
1750 } |
|
1751 if(theRes == KErrAccessDenied) |
|
1752 { |
|
1753 INFO_PRINTF1(_L("Access denied" )); |
|
1754 } |
|
1755 |
|
1756 return theRes; |
|
1757 } |
|
1758 |
|
1759 //prepare encode data |
|
1760 |
|
1761 // do conversion |
|
1762 CActiveListener* activeListener = new(ELeave)CActiveListener; |
|
1763 CleanupStack::PushL( activeListener ); |
|
1764 |
|
1765 iActiveScheduler->SetEncoder(iImageEncoder, activeListener, 0); |
|
1766 iActiveScheduler->SetStep(this); |
|
1767 |
|
1768 activeListener->InitialiseActiveListener(); |
|
1769 iImageEncoder->Convert(&activeListener->iStatus, *theBitmap); |
|
1770 CActiveScheduler::Start(); |
|
1771 |
|
1772 theRes = activeListener->iStatus.Int(); |
|
1773 iActiveScheduler->SetStep(NULL); |
|
1774 |
|
1775 //delete all local value |
|
1776 delete iImageEncoder; |
|
1777 iImageEncoder = NULL; |
|
1778 |
|
1779 theBitmap->Reset(); |
|
1780 |
|
1781 CleanupStack::PopAndDestroy(2); //active sheduler, theBitmap |
|
1782 |
|
1783 iFs.Close(); |
|
1784 |
|
1785 if(theRes != KErrNone) |
|
1786 { |
|
1787 INFO_PRINTF1(_L("Error during conversion" )); |
|
1788 return theRes; |
|
1789 } |
|
1790 else |
|
1791 { |
|
1792 INFO_PRINTF1(_L("Conversion was successful" )); |
|
1793 } |
|
1794 |
|
1795 return theRes; |
|
1796 } |
|
1797 |
|
1798 |
|
1799 |
|
1800 |
|
1801 |
|
1802 |