imaging/imaginginttest/src/TestImageDecoderFileSource.cpp
changeset 0 5752a19fdefe
equal deleted inserted replaced
-1:000000000000 0:5752a19fdefe
       
     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 // Integration tests.
       
    15 // 
       
    16 //
       
    17 
       
    18 #include <testframework.h>
       
    19 
       
    20 #include "TestImageDecoderFileSource.h"
       
    21 
       
    22 // Positive Tests
       
    23 
       
    24 /**
       
    25 *
       
    26 * Ctor for CTestImageDecFileSource
       
    27 *
       
    28 * @param The name of this test step used by the script file.
       
    29 *
       
    30 * @return CTestImageDecFileSource*: 
       
    31 *                           Constructed CTestImageDecFileSource object
       
    32 *
       
    33 */
       
    34 CTestImageDecFileSource *CTestImageDecFileSource::NewL(const TDesC& aTestName)
       
    35     {
       
    36     return new (ELeave) CTestImageDecFileSource(aTestName);
       
    37     }
       
    38 
       
    39 /**
       
    40 *
       
    41 * Test step constructor.
       
    42 * Each test step initialises its own name.
       
    43 *
       
    44 * @param The name of this test step.
       
    45 *
       
    46 */
       
    47 CTestImageDecFileSource::CTestImageDecFileSource(const TDesC& aTestName) : 
       
    48     CTestStepConversion(aTestName)
       
    49     {
       
    50     iHeapSize = 500000;
       
    51     }
       
    52 
       
    53 /**
       
    54 *
       
    55 * Do the test step.
       
    56 * Each test step must supply an implementation for DoTestStepL.
       
    57 *
       
    58 * @return TVerdict: The result of the test step.
       
    59 *
       
    60 */
       
    61 TVerdict CTestImageDecFileSource::DoTestStepL()
       
    62     {
       
    63     TVerdict result = EPass;
       
    64     if ((iTestStepName.Compare(_L("MM-ICL-FRM-I-0800-HP")) == 0) || // TMMFileSource
       
    65         (iTestStepName.Compare(_L("MM-ICL-FRM-I-0801-HP")) == 0) )  // TMMFileSource, mimeType
       
    66         {
       
    67         result = TestStep_I_0800_0801L();
       
    68         }
       
    69 
       
    70     return result;
       
    71     }
       
    72 
       
    73 /**
       
    74 *
       
    75 * Read and decode an image, a JPEG, from a file.
       
    76 *
       
    77 * @return   TVerdict: The result of the test step.
       
    78 *
       
    79 */
       
    80 TVerdict CTestImageDecFileSource::TestStep_I_0800_0801L()
       
    81     {
       
    82     // Dummy Hal call for heap balance on target
       
    83     if (DummyHalCall() != KErrNone)
       
    84         {
       
    85         return EInconclusive;
       
    86         }
       
    87 
       
    88     __MM_HEAP_MARK;
       
    89 
       
    90     TInt err = KErrNone;
       
    91     err = RFbsSession::Connect();
       
    92     if (err != KErrNone)
       
    93         {
       
    94         INFO_PRINTF2(_L("RFbsSession::Connect() failed, err = %d"), err);
       
    95         return EInconclusive;
       
    96         }
       
    97 
       
    98     // Open and decode the image
       
    99     TRAP(err, OpenImageAndDecodeFromFileSourceL(iFileNameSrc));
       
   100 
       
   101     RFbsSession::Disconnect();
       
   102     
       
   103     __MM_HEAP_MARKEND; 
       
   104 
       
   105     if (err == KErrNone)
       
   106         {
       
   107         return EPass;
       
   108         }
       
   109     else
       
   110         {
       
   111         INFO_PRINTF2(_L("Error in opening/decoding the image : %d"), err);
       
   112         return EFail;
       
   113         }
       
   114     }
       
   115 
       
   116 /**
       
   117 *
       
   118 * Read and decode an image, a JPEG, from a file passing FileSource.
       
   119 *
       
   120 * @param filename of the image
       
   121 *
       
   122 * @leave err: Leaves with 'err'.
       
   123 *
       
   124 */
       
   125 void CTestImageDecFileSource::OpenImageAndDecodeFromFileSourceL(const TDesC& aFileName)
       
   126     {
       
   127     // Get the path
       
   128     TFileName theSourceFilename;
       
   129     Directory(EInput, theSourceFilename);
       
   130     theSourceFilename.Append(aFileName);
       
   131 
       
   132     User::LeaveIfError(iFs.Connect());
       
   133 
       
   134     // Create TMMFileSource
       
   135     TMMFileSource fileSource(theSourceFilename);
       
   136 
       
   137     // Open the image and create an image decoder
       
   138     TInt err = KErrNone;
       
   139     if (iTestStepName.Compare(_L("MM-ICL-FRM-I-0800-HP")) == 0)
       
   140         {
       
   141         INFO_PRINTF2(_L("Opening the file by passing FileSource : %S"), &theSourceFilename);
       
   142         TRAP(err, iImageDecoder = CImageDecoder::FileNewL(iFs, fileSource));
       
   143         }
       
   144     else if (iTestStepName.Compare(_L("MM-ICL-FRM-I-0801-HP")) == 0)
       
   145         {
       
   146         INFO_PRINTF2(_L("Opening the file by passing FileSource and MIME type : %S"), &theSourceFilename);
       
   147         TBuf8<KMaxMimeLength> mimeType;
       
   148         ReadMimeTypeFromConfig(mimeType); // MIME type
       
   149         TRAP(err, iImageDecoder = CImageDecoder::FileNewL(iFs, fileSource, mimeType));
       
   150         }
       
   151 
       
   152     if (err != KErrNone)
       
   153         {
       
   154         INFO_PRINTF3(_L("Cannot open file: %S. Unexpected Error: %d"), &theSourceFilename, err);
       
   155         delete iImageDecoder;
       
   156         iImageDecoder = NULL;
       
   157 
       
   158         User::Leave(err);
       
   159         }
       
   160 
       
   161     if (iImageDecoder == NULL)
       
   162         {
       
   163         INFO_PRINTF1(_L("ImageDecoder is NULL!"));
       
   164         User::Leave(err);
       
   165         }
       
   166 
       
   167     INFO_PRINTF2(_L("The file: %S had been opened."), &theSourceFilename);
       
   168 
       
   169     // Create an active listener and push it on the cleanup stack
       
   170     CActiveListener* activeListener = new (ELeave) CActiveListener;
       
   171     CleanupStack::PushL(activeListener);
       
   172     
       
   173     const TFrameInfo* theFrameInfo = &iImageDecoder->FrameInfo();
       
   174 
       
   175     // Create the destination bitmap
       
   176     CFbsBitmap* destBitmap = new (ELeave) CFbsBitmap;
       
   177     CleanupStack::PushL(destBitmap);
       
   178 
       
   179     // Create the destination bitmap with the specified size and display mode
       
   180     User::LeaveIfError(destBitmap->Create(
       
   181         theFrameInfo->iOverallSizeInPixels,
       
   182         theFrameInfo->iFrameDisplayMode));
       
   183 
       
   184     activeListener ->InitialiseActiveListener();
       
   185 
       
   186     // Decode the image
       
   187     iImageDecoder->Convert(&activeListener->iStatus, *destBitmap, 0);
       
   188     CActiveScheduler::Start();
       
   189 
       
   190     err = activeListener -> iStatus.Int();
       
   191     if (err == KErrNone)
       
   192         {
       
   193         INFO_PRINTF2(_L("Conversion of file %S was successfull!"), &theSourceFilename);
       
   194         }
       
   195     else
       
   196         {
       
   197         INFO_PRINTF2(_L("Failed during conversion of the file: %S"), &theSourceFilename);
       
   198         delete iImageDecoder;
       
   199         iImageDecoder = NULL;
       
   200 
       
   201         // activeListener, destBitmap
       
   202         CleanupStack::PopAndDestroy(2, activeListener);
       
   203 
       
   204         User::Leave(err);
       
   205         }
       
   206 
       
   207     TFileName theReferenceFilename;
       
   208     TBuf<KLenBufferExtension> theExtension;
       
   209 
       
   210     Directory(EReference, theReferenceFilename);
       
   211     TInt theSeparatorPos = aFileName.LocateReverse('.') + 1;
       
   212     theReferenceFilename.Append(aFileName.Left(theSeparatorPos));
       
   213     GetImageExtension(KImageTypeMBMUid, theExtension);
       
   214     theReferenceFilename.Append(theExtension);
       
   215 
       
   216     if (err == KErrNone)
       
   217         {
       
   218         // Check the bitmaps
       
   219         err = CheckBitmapL(*destBitmap, theReferenceFilename);
       
   220         }
       
   221 
       
   222     delete iImageDecoder;
       
   223     iImageDecoder = NULL;
       
   224 
       
   225     // activeListener, destBitmap
       
   226     CleanupStack::PopAndDestroy(2, activeListener);
       
   227 
       
   228     User::Leave(err);
       
   229     }
       
   230 
       
   231 
       
   232 
       
   233 /**
       
   234 *
       
   235 * Ctor for CTestImageDecFileHandleSource
       
   236 *
       
   237 * @param The name of this test step used by the script file.
       
   238 *
       
   239 * @return CTestImageDecFileHandleSource*: 
       
   240 *                           Constructed CTestImageDecFileHandleSource object
       
   241 *
       
   242 */
       
   243 CTestImageDecFileHandleSource *CTestImageDecFileHandleSource::NewL(const TDesC& aTestName)
       
   244     {
       
   245     return new (ELeave) CTestImageDecFileHandleSource(aTestName);
       
   246     }
       
   247 
       
   248 /**
       
   249 *
       
   250 * Test step constructor.
       
   251 * Each test step initialises its own name.
       
   252 *
       
   253 * @param The name of this test step.
       
   254 *
       
   255 */
       
   256 CTestImageDecFileHandleSource::CTestImageDecFileHandleSource(const TDesC& aTestName) : 
       
   257     CTestStepConversion(aTestName)
       
   258     {
       
   259     iHeapSize = 500000;
       
   260     }
       
   261 
       
   262 /**
       
   263 *
       
   264 * Do the test step.
       
   265 * Each test step must supply an implementation for DoTestStepL.
       
   266 *
       
   267 * @return TVerdict: The result of the test step.
       
   268 *
       
   269 */
       
   270 TVerdict CTestImageDecFileHandleSource::DoTestStepL()
       
   271     {
       
   272     TVerdict result = EPass;
       
   273     if ((iTestStepName.Compare(_L("MM-ICL-FRM-I-0802-HP")) == 0) || // TMMFileHandleSource
       
   274         (iTestStepName.Compare(_L("MM-ICL-FRM-I-0803-HP")) == 0))   // TMMFileHandleSource, mimeType
       
   275         {
       
   276         result = TestStep_I_0802_0803L();
       
   277         }
       
   278 
       
   279     return result;
       
   280     }
       
   281 
       
   282 /**
       
   283 *
       
   284 * Read and decode an image, a JPEG, from a file passing FileHandleSource.
       
   285 *
       
   286 * @return   TVerdict: The result of the test step.
       
   287 *
       
   288 */
       
   289 TVerdict CTestImageDecFileHandleSource::TestStep_I_0802_0803L()
       
   290     {
       
   291     // Dummy Hal call for heap balance on target
       
   292     if (DummyHalCall() != KErrNone)
       
   293         {
       
   294         return EInconclusive;
       
   295         }
       
   296 
       
   297     __MM_HEAP_MARK;
       
   298 
       
   299     TInt err = KErrNone;
       
   300     User::LeaveIfError(FbsStartup());
       
   301     err = RFbsSession::Connect();
       
   302     if (err != KErrNone)
       
   303         {
       
   304         INFO_PRINTF2(_L("RFbsSession::Connect() failed, err = %d"), err);
       
   305         return EInconclusive;
       
   306         }
       
   307 
       
   308     // Open and decode the image
       
   309     TRAP(err, OpenImageAndDecodeFromFileHandleSourceL(iFileNameSrc));
       
   310 
       
   311     RFbsSession::Disconnect();
       
   312     
       
   313     __MM_HEAP_MARKEND; 
       
   314 
       
   315     if (err == KErrNone)
       
   316         {
       
   317         return EPass;
       
   318         }
       
   319     else
       
   320         {
       
   321         INFO_PRINTF2(_L("Error in opening/decoding the image : %d"), err);
       
   322         return EFail;
       
   323         }
       
   324     }
       
   325 
       
   326 /**
       
   327 *
       
   328 * Read and decode an image, a JPEG, from a file passing FileHandleSource.
       
   329 *
       
   330 * @param filename of the image
       
   331 *
       
   332 * @leave err: Leaves with 'err'.
       
   333 *
       
   334 */
       
   335 void CTestImageDecFileHandleSource::OpenImageAndDecodeFromFileHandleSourceL(const TDesC& aFileName)
       
   336     {
       
   337     // Get the path
       
   338     TFileName theSourceFilename;
       
   339     Directory(EInput, theSourceFilename);
       
   340     theSourceFilename.Append(aFileName);
       
   341 
       
   342     User::LeaveIfError(iFs.Connect());
       
   343 
       
   344     INFO_PRINTF2(_L("Opening the file by RFile : %S"), &theSourceFilename);
       
   345     RFile rFile;
       
   346     TInt res = rFile.Open(iFs, theSourceFilename, EFileWrite);
       
   347     User::LeaveIfError(res);
       
   348 
       
   349     // Create TMMFileHandleSource
       
   350     TMMFileHandleSource fileHandleSource(rFile);
       
   351 
       
   352     // Open the image and create an image decoder
       
   353     TInt err = KErrNone;
       
   354     if (iTestStepName.Compare(_L("MM-ICL-FRM-I-0802-HP")) == 0)
       
   355         {
       
   356         INFO_PRINTF2(_L("Opening the file by passing FileHandleSource : %S"), &theSourceFilename);
       
   357         TRAP(err, iImageDecoder = CImageDecoder::FileNewL(iFs, fileHandleSource));
       
   358         }
       
   359     else if (iTestStepName.Compare(_L("MM-ICL-FRM-I-0803-HP")) == 0)
       
   360         {
       
   361         INFO_PRINTF2(_L("Opening the file by passing FileHandleSource and MIME type : %S"), &theSourceFilename);
       
   362         TBuf8<KMaxMimeLength> mimeType;
       
   363         ReadMimeTypeFromConfig(mimeType); // MIME type
       
   364         TRAP(err, iImageDecoder = CImageDecoder::FileNewL(iFs, fileHandleSource, mimeType));
       
   365         }
       
   366 
       
   367     if (err != KErrNone)
       
   368         {
       
   369         INFO_PRINTF3(_L("Cannot open file: %S. Unexpected Error: %d"), &theSourceFilename, err);
       
   370         delete iImageDecoder;
       
   371         iImageDecoder = NULL;
       
   372 
       
   373         User::Leave(err);
       
   374         }
       
   375 
       
   376     if (iImageDecoder == NULL)
       
   377         {
       
   378         INFO_PRINTF1(_L("ImageDecoder is NULL!"));
       
   379         User::Leave(err);
       
   380         }
       
   381 
       
   382     INFO_PRINTF2(_L("The file: %S had been opened."), &theSourceFilename);
       
   383 
       
   384     // Create an active listener and push it on the cleanup stack
       
   385     CActiveListener* activeListener = new (ELeave) CActiveListener;
       
   386     CleanupStack::PushL(activeListener);
       
   387 
       
   388     const TFrameInfo* theFrameInfo = &iImageDecoder->FrameInfo();
       
   389 
       
   390     // Create the destination bitmap
       
   391     CFbsBitmap* destBitmap = new (ELeave) CFbsBitmap;
       
   392     CleanupStack::PushL(destBitmap);
       
   393 
       
   394     // Create the destination bitmap with the specified size and display mode
       
   395     User::LeaveIfError(destBitmap->Create(
       
   396         theFrameInfo->iOverallSizeInPixels,
       
   397         theFrameInfo->iFrameDisplayMode));
       
   398 
       
   399     activeListener ->InitialiseActiveListener();
       
   400 
       
   401     // Decode the image
       
   402     iImageDecoder->Convert(&activeListener->iStatus, *destBitmap, 0);
       
   403     CActiveScheduler::Start();
       
   404 
       
   405     err = activeListener -> iStatus.Int();
       
   406     if (err == KErrNone)
       
   407         {
       
   408         INFO_PRINTF2(_L("Conversion of file %S was successfull!"), &theSourceFilename);
       
   409         }
       
   410     else
       
   411         {
       
   412         INFO_PRINTF2(_L("Failed during conversion of the file: %S"), &theSourceFilename);
       
   413         delete iImageDecoder;
       
   414         iImageDecoder = NULL;
       
   415 
       
   416         // activeListener, destBitmap
       
   417         CleanupStack::PopAndDestroy(2, activeListener);
       
   418 
       
   419         User::Leave(err);
       
   420         }
       
   421 
       
   422     TFileName theReferenceFilename;
       
   423     TBuf<KLenBufferExtension> theExtension;
       
   424 
       
   425     Directory(EReference, theReferenceFilename);
       
   426     TInt theSeparatorPos = aFileName.LocateReverse('.') + 1;
       
   427     theReferenceFilename.Append(aFileName.Left(theSeparatorPos));
       
   428     GetImageExtension(KImageTypeMBMUid, theExtension);
       
   429     theReferenceFilename.Append(theExtension);
       
   430 
       
   431     if (err == KErrNone)
       
   432         {
       
   433         // Check the bitmaps
       
   434         err = CheckBitmapL(*destBitmap, theReferenceFilename);
       
   435         }
       
   436 
       
   437     delete iImageDecoder;
       
   438     iImageDecoder = NULL;
       
   439 
       
   440     // activeListener, destBitmap
       
   441     CleanupStack::PopAndDestroy(2, activeListener);
       
   442 
       
   443     User::Leave(err);
       
   444     }
       
   445 
       
   446 // Test to check for bitmap created using CreateExtendedBitmap
       
   447 
       
   448 CTestImageDecFileSourceExtendedBitmap *CTestImageDecFileSourceExtendedBitmap::NewL(const TDesC& aTestName)
       
   449     {
       
   450     return new (ELeave) CTestImageDecFileSourceExtendedBitmap(aTestName);
       
   451     }
       
   452 
       
   453 
       
   454 
       
   455 
       
   456 /**
       
   457 *
       
   458 * Test step constructor.
       
   459 * Each test step initialises its own name.
       
   460 *
       
   461 * @param The name of this test step.
       
   462 *
       
   463 */
       
   464 CTestImageDecFileSourceExtendedBitmap::CTestImageDecFileSourceExtendedBitmap(const TDesC& aTestName) : 
       
   465     CTestStepConversion(aTestName)
       
   466     {
       
   467     iHeapSize = 500000;
       
   468     }
       
   469 
       
   470 /**
       
   471 *
       
   472 * Do the test step.
       
   473 * Each test step must supply an implementation for DoTestStepL.
       
   474 *
       
   475 * @return TVerdict: The result of the test step.
       
   476 *
       
   477 */
       
   478 TVerdict CTestImageDecFileSourceExtendedBitmap::DoTestStepL()
       
   479     {
       
   480     TVerdict result = EPass;
       
   481    
       
   482     result = TestStep_I_0804L();
       
   483         
       
   484 
       
   485     return result;
       
   486     }
       
   487 
       
   488 /**
       
   489 *
       
   490 * Read and decode an image, a JPEG, from a file.
       
   491 *
       
   492 * @return   TVerdict: The result of the test step.
       
   493 *
       
   494 */
       
   495 TVerdict CTestImageDecFileSourceExtendedBitmap::TestStep_I_0804L()
       
   496     {
       
   497     // Dummy Hal call for heap balance on target
       
   498     if (DummyHalCall() != KErrNone)
       
   499         {
       
   500         return EInconclusive;
       
   501         }
       
   502 
       
   503     __MM_HEAP_MARK;
       
   504 
       
   505     TInt err = KErrNone;
       
   506     User::LeaveIfError(FbsStartup());
       
   507     err = RFbsSession::Connect();
       
   508     if (err != KErrNone)
       
   509         {
       
   510         INFO_PRINTF2(_L("RFbsSession::Connect() failed, err = %d"), err);
       
   511         return EInconclusive;
       
   512         }
       
   513 
       
   514     // Open and decode the image
       
   515     TRAP(err, OpenImageAndDecodeFromFileSourceL(iFileNameSrc));
       
   516 
       
   517     RFbsSession::Disconnect();
       
   518     
       
   519     __MM_HEAP_MARKEND; 
       
   520 
       
   521     if (err == KErrNone)
       
   522         {
       
   523         return EPass;
       
   524         }
       
   525     else
       
   526         {
       
   527         INFO_PRINTF2(_L("Error in opening/decoding the image : %d"), err);
       
   528         return EFail;
       
   529         }
       
   530     }
       
   531 
       
   532 
       
   533 TInt CTestImageDecFileSourceExtendedBitmap::InitExtendedBitmap(TAny* /*aData*/, TInt /*aDataSize*/)
       
   534     {
       
   535     return KErrNone;
       
   536     }
       
   537 /**
       
   538 *
       
   539 * Read and decode an image, a JPEG, from a file passing FileSource.
       
   540 *
       
   541 * @param filename of the image
       
   542 *
       
   543 * @leave err: Leaves with 'err'.
       
   544 *
       
   545 */
       
   546 void CTestImageDecFileSourceExtendedBitmap::OpenImageAndDecodeFromFileSourceL(const TDesC& aFileName)
       
   547     {
       
   548     // Get the path
       
   549     TFileName theSourceFilename;
       
   550     Directory(EInput, theSourceFilename);
       
   551     theSourceFilename.Append(aFileName);
       
   552 
       
   553     User::LeaveIfError(iFs.Connect());
       
   554 
       
   555     // Create TMMFileSource
       
   556     TMMFileSource fileSource(theSourceFilename);
       
   557 
       
   558     // Open the image and create an image decoder
       
   559     TInt err = KErrNone;
       
   560     
       
   561        
       
   562     INFO_PRINTF2(_L("Opening the file by passing FileSource : %S"), &theSourceFilename);
       
   563     TRAP(err, iImageDecoder = CImageDecoder::FileNewL(iFs, fileSource));
       
   564            
       
   565 
       
   566     if (err != KErrNone)
       
   567         {
       
   568         INFO_PRINTF3(_L("Cannot open file: %S. Unexpected Error: %d"), &theSourceFilename, err);
       
   569         delete iImageDecoder;
       
   570         iImageDecoder = NULL;
       
   571 
       
   572         User::Leave(err);
       
   573         }
       
   574 
       
   575     if (iImageDecoder == NULL)
       
   576         {
       
   577         INFO_PRINTF1(_L("ImageDecoder is NULL!"));
       
   578         User::Leave(err);
       
   579         }
       
   580 
       
   581     INFO_PRINTF2(_L("The file: %S had been opened."), &theSourceFilename);
       
   582 
       
   583     // Create an active listener and push it on the cleanup stack
       
   584     CActiveListener* activeListener = new (ELeave) CActiveListener;
       
   585     CleanupStack::PushL(activeListener);
       
   586     
       
   587     const TFrameInfo* theFrameInfo = &iImageDecoder->FrameInfo();
       
   588 
       
   589     // Create the destination bitmap
       
   590     CFbsBitmap* destBitmap = new (ELeave) CFbsBitmap;
       
   591     
       
   592     CleanupStack::PushL(destBitmap);
       
   593 
       
   594         
       
   595     User::LeaveIfError(destBitmap->CreateExtendedBitmap(
       
   596             theFrameInfo->iOverallSizeInPixels,
       
   597             theFrameInfo->iFrameDisplayMode,KImageTypeJPGUid,29143,*this));
       
   598 
       
   599     activeListener ->InitialiseActiveListener();
       
   600 
       
   601     // Decode the image
       
   602     iImageDecoder->Convert(&activeListener->iStatus, *destBitmap, 0);
       
   603     CActiveScheduler::Start();
       
   604 
       
   605     err = activeListener -> iStatus.Int();
       
   606     if (err == KErrNone)
       
   607         {
       
   608         INFO_PRINTF1(_L("Expected KErrNotSupported by now. Convert did not return any error."));
       
   609         delete iImageDecoder;
       
   610         iImageDecoder = NULL;
       
   611 
       
   612         // activeListener, destBitmap
       
   613         CleanupStack::PopAndDestroy(2, activeListener);
       
   614         User::Leave(KErrGeneral);
       
   615         }
       
   616     else
       
   617         {
       
   618         if(err== KErrNotSupported)
       
   619             {
       
   620             INFO_PRINTF1(_L("Got KErrNotSupported as expected"));
       
   621             }
       
   622         else
       
   623             {
       
   624             delete iImageDecoder;
       
   625             iImageDecoder = NULL;
       
   626 
       
   627             // activeListener, destBitmap
       
   628             CleanupStack::PopAndDestroy(2, activeListener);
       
   629             INFO_PRINTF1(_L("Unexpected error"));
       
   630             User::Leave(err);
       
   631             }
       
   632         }
       
   633 
       
   634    
       
   635 
       
   636     delete iImageDecoder;
       
   637     iImageDecoder = NULL;
       
   638 
       
   639     // activeListener, destBitmap
       
   640     CleanupStack::PopAndDestroy(2, activeListener);
       
   641 
       
   642     }
       
   643