imagingandcamerafws/imaginginttest/src/TestImageDecoderFileSource.cpp
changeset 0 40261b775718
child 41 f7bf1ed8db72
equal deleted inserted replaced
-1:000000000000 0:40261b775718
       
     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     err = RFbsSession::Connect();
       
   301     if (err != KErrNone)
       
   302         {
       
   303         INFO_PRINTF2(_L("RFbsSession::Connect() failed, err = %d"), err);
       
   304         return EInconclusive;
       
   305         }
       
   306 
       
   307     // Open and decode the image
       
   308     TRAP(err, OpenImageAndDecodeFromFileHandleSourceL(iFileNameSrc));
       
   309 
       
   310     RFbsSession::Disconnect();
       
   311     
       
   312     __MM_HEAP_MARKEND; 
       
   313 
       
   314     if (err == KErrNone)
       
   315         {
       
   316         return EPass;
       
   317         }
       
   318     else
       
   319         {
       
   320         INFO_PRINTF2(_L("Error in opening/decoding the image : %d"), err);
       
   321         return EFail;
       
   322         }
       
   323     }
       
   324 
       
   325 /**
       
   326 *
       
   327 * Read and decode an image, a JPEG, from a file passing FileHandleSource.
       
   328 *
       
   329 * @param filename of the image
       
   330 *
       
   331 * @leave err: Leaves with 'err'.
       
   332 *
       
   333 */
       
   334 void CTestImageDecFileHandleSource::OpenImageAndDecodeFromFileHandleSourceL(const TDesC& aFileName)
       
   335     {
       
   336     // Get the path
       
   337     TFileName theSourceFilename;
       
   338     Directory(EInput, theSourceFilename);
       
   339     theSourceFilename.Append(aFileName);
       
   340 
       
   341     User::LeaveIfError(iFs.Connect());
       
   342 
       
   343     INFO_PRINTF2(_L("Opening the file by RFile : %S"), &theSourceFilename);
       
   344     RFile rFile;
       
   345     TInt res = rFile.Open(iFs, theSourceFilename, EFileWrite);
       
   346     User::LeaveIfError(res);
       
   347 
       
   348     // Create TMMFileHandleSource
       
   349     TMMFileHandleSource fileHandleSource(rFile);
       
   350 
       
   351     // Open the image and create an image decoder
       
   352     TInt err = KErrNone;
       
   353     if (iTestStepName.Compare(_L("MM-ICL-FRM-I-0802-HP")) == 0)
       
   354         {
       
   355         INFO_PRINTF2(_L("Opening the file by passing FileHandleSource : %S"), &theSourceFilename);
       
   356         TRAP(err, iImageDecoder = CImageDecoder::FileNewL(iFs, fileHandleSource));
       
   357         }
       
   358     else if (iTestStepName.Compare(_L("MM-ICL-FRM-I-0803-HP")) == 0)
       
   359         {
       
   360         INFO_PRINTF2(_L("Opening the file by passing FileHandleSource and MIME type : %S"), &theSourceFilename);
       
   361         TBuf8<KMaxMimeLength> mimeType;
       
   362         ReadMimeTypeFromConfig(mimeType); // MIME type
       
   363         TRAP(err, iImageDecoder = CImageDecoder::FileNewL(iFs, fileHandleSource, mimeType));
       
   364         }
       
   365 
       
   366     if (err != KErrNone)
       
   367         {
       
   368         INFO_PRINTF3(_L("Cannot open file: %S. Unexpected Error: %d"), &theSourceFilename, err);
       
   369         delete iImageDecoder;
       
   370         iImageDecoder = NULL;
       
   371 
       
   372         User::Leave(err);
       
   373         }
       
   374 
       
   375     if (iImageDecoder == NULL)
       
   376         {
       
   377         INFO_PRINTF1(_L("ImageDecoder is NULL!"));
       
   378         User::Leave(err);
       
   379         }
       
   380 
       
   381     INFO_PRINTF2(_L("The file: %S had been opened."), &theSourceFilename);
       
   382 
       
   383     // Create an active listener and push it on the cleanup stack
       
   384     CActiveListener* activeListener = new (ELeave) CActiveListener;
       
   385     CleanupStack::PushL(activeListener);
       
   386 
       
   387     const TFrameInfo* theFrameInfo = &iImageDecoder->FrameInfo();
       
   388 
       
   389     // Create the destination bitmap
       
   390     CFbsBitmap* destBitmap = new (ELeave) CFbsBitmap;
       
   391     CleanupStack::PushL(destBitmap);
       
   392 
       
   393     // Create the destination bitmap with the specified size and display mode
       
   394     User::LeaveIfError(destBitmap->Create(
       
   395         theFrameInfo->iOverallSizeInPixels,
       
   396         theFrameInfo->iFrameDisplayMode));
       
   397 
       
   398     activeListener ->InitialiseActiveListener();
       
   399 
       
   400     // Decode the image
       
   401     iImageDecoder->Convert(&activeListener->iStatus, *destBitmap, 0);
       
   402     CActiveScheduler::Start();
       
   403 
       
   404     err = activeListener -> iStatus.Int();
       
   405     if (err == KErrNone)
       
   406         {
       
   407         INFO_PRINTF2(_L("Conversion of file %S was successfull!"), &theSourceFilename);
       
   408         }
       
   409     else
       
   410         {
       
   411         INFO_PRINTF2(_L("Failed during conversion of the file: %S"), &theSourceFilename);
       
   412         delete iImageDecoder;
       
   413         iImageDecoder = NULL;
       
   414 
       
   415         // activeListener, destBitmap
       
   416         CleanupStack::PopAndDestroy(2, activeListener);
       
   417 
       
   418         User::Leave(err);
       
   419         }
       
   420 
       
   421     TFileName theReferenceFilename;
       
   422     TBuf<KLenBufferExtension> theExtension;
       
   423 
       
   424     Directory(EReference, theReferenceFilename);
       
   425     TInt theSeparatorPos = aFileName.LocateReverse('.') + 1;
       
   426     theReferenceFilename.Append(aFileName.Left(theSeparatorPos));
       
   427     GetImageExtension(KImageTypeMBMUid, theExtension);
       
   428     theReferenceFilename.Append(theExtension);
       
   429 
       
   430     if (err == KErrNone)
       
   431         {
       
   432         // Check the bitmaps
       
   433         err = CheckBitmapL(*destBitmap, theReferenceFilename);
       
   434         }
       
   435 
       
   436     delete iImageDecoder;
       
   437     iImageDecoder = NULL;
       
   438 
       
   439     // activeListener, destBitmap
       
   440     CleanupStack::PopAndDestroy(2, activeListener);
       
   441 
       
   442     User::Leave(err);
       
   443     }
       
   444 
       
   445 // Test to check for bitmap created using CreateExtendedBitmap
       
   446 
       
   447 CTestImageDecFileSourceExtendedBitmap *CTestImageDecFileSourceExtendedBitmap::NewL(const TDesC& aTestName)
       
   448     {
       
   449     return new (ELeave) CTestImageDecFileSourceExtendedBitmap(aTestName);
       
   450     }
       
   451 
       
   452 
       
   453 
       
   454 
       
   455 /**
       
   456 *
       
   457 * Test step constructor.
       
   458 * Each test step initialises its own name.
       
   459 *
       
   460 * @param The name of this test step.
       
   461 *
       
   462 */
       
   463 CTestImageDecFileSourceExtendedBitmap::CTestImageDecFileSourceExtendedBitmap(const TDesC& aTestName) : 
       
   464     CTestStepConversion(aTestName)
       
   465     {
       
   466     iHeapSize = 500000;
       
   467     }
       
   468 
       
   469 /**
       
   470 *
       
   471 * Do the test step.
       
   472 * Each test step must supply an implementation for DoTestStepL.
       
   473 *
       
   474 * @return TVerdict: The result of the test step.
       
   475 *
       
   476 */
       
   477 TVerdict CTestImageDecFileSourceExtendedBitmap::DoTestStepL()
       
   478     {
       
   479     TVerdict result = EPass;
       
   480    
       
   481     result = TestStep_I_0804L();
       
   482         
       
   483 
       
   484     return result;
       
   485     }
       
   486 
       
   487 /**
       
   488 *
       
   489 * Read and decode an image, a JPEG, from a file.
       
   490 *
       
   491 * @return   TVerdict: The result of the test step.
       
   492 *
       
   493 */
       
   494 TVerdict CTestImageDecFileSourceExtendedBitmap::TestStep_I_0804L()
       
   495     {
       
   496     // Dummy Hal call for heap balance on target
       
   497     if (DummyHalCall() != KErrNone)
       
   498         {
       
   499         return EInconclusive;
       
   500         }
       
   501 
       
   502     __MM_HEAP_MARK;
       
   503 
       
   504     TInt err = KErrNone;
       
   505     err = RFbsSession::Connect();
       
   506     if (err != KErrNone)
       
   507         {
       
   508         INFO_PRINTF2(_L("RFbsSession::Connect() failed, err = %d"), err);
       
   509         return EInconclusive;
       
   510         }
       
   511 
       
   512     // Open and decode the image
       
   513     TRAP(err, OpenImageAndDecodeFromFileSourceL(iFileNameSrc));
       
   514 
       
   515     RFbsSession::Disconnect();
       
   516     
       
   517     __MM_HEAP_MARKEND; 
       
   518 
       
   519     if (err == KErrNone)
       
   520         {
       
   521         return EPass;
       
   522         }
       
   523     else
       
   524         {
       
   525         INFO_PRINTF2(_L("Error in opening/decoding the image : %d"), err);
       
   526         return EFail;
       
   527         }
       
   528     }
       
   529 
       
   530 
       
   531 TInt CTestImageDecFileSourceExtendedBitmap::InitExtendedBitmap(TAny* /*aData*/, TInt /*aDataSize*/)
       
   532     {
       
   533     return KErrNone;
       
   534     }
       
   535 /**
       
   536 *
       
   537 * Read and decode an image, a JPEG, from a file passing FileSource.
       
   538 *
       
   539 * @param filename of the image
       
   540 *
       
   541 * @leave err: Leaves with 'err'.
       
   542 *
       
   543 */
       
   544 void CTestImageDecFileSourceExtendedBitmap::OpenImageAndDecodeFromFileSourceL(const TDesC& aFileName)
       
   545     {
       
   546     // Get the path
       
   547     TFileName theSourceFilename;
       
   548     Directory(EInput, theSourceFilename);
       
   549     theSourceFilename.Append(aFileName);
       
   550 
       
   551     User::LeaveIfError(iFs.Connect());
       
   552 
       
   553     // Create TMMFileSource
       
   554     TMMFileSource fileSource(theSourceFilename);
       
   555 
       
   556     // Open the image and create an image decoder
       
   557     TInt err = KErrNone;
       
   558     
       
   559        
       
   560     INFO_PRINTF2(_L("Opening the file by passing FileSource : %S"), &theSourceFilename);
       
   561     TRAP(err, iImageDecoder = CImageDecoder::FileNewL(iFs, fileSource));
       
   562            
       
   563 
       
   564     if (err != KErrNone)
       
   565         {
       
   566         INFO_PRINTF3(_L("Cannot open file: %S. Unexpected Error: %d"), &theSourceFilename, err);
       
   567         delete iImageDecoder;
       
   568         iImageDecoder = NULL;
       
   569 
       
   570         User::Leave(err);
       
   571         }
       
   572 
       
   573     if (iImageDecoder == NULL)
       
   574         {
       
   575         INFO_PRINTF1(_L("ImageDecoder is NULL!"));
       
   576         User::Leave(err);
       
   577         }
       
   578 
       
   579     INFO_PRINTF2(_L("The file: %S had been opened."), &theSourceFilename);
       
   580 
       
   581     // Create an active listener and push it on the cleanup stack
       
   582     CActiveListener* activeListener = new (ELeave) CActiveListener;
       
   583     CleanupStack::PushL(activeListener);
       
   584     
       
   585     const TFrameInfo* theFrameInfo = &iImageDecoder->FrameInfo();
       
   586 
       
   587     // Create the destination bitmap
       
   588     CFbsBitmap* destBitmap = new (ELeave) CFbsBitmap;
       
   589     
       
   590     CleanupStack::PushL(destBitmap);
       
   591 
       
   592         
       
   593     User::LeaveIfError(destBitmap->CreateExtendedBitmap(
       
   594             theFrameInfo->iOverallSizeInPixels,
       
   595             theFrameInfo->iFrameDisplayMode,KImageTypeJPGUid,29143,*this));
       
   596 
       
   597     activeListener ->InitialiseActiveListener();
       
   598 
       
   599     // Decode the image
       
   600     iImageDecoder->Convert(&activeListener->iStatus, *destBitmap, 0);
       
   601     CActiveScheduler::Start();
       
   602 
       
   603     err = activeListener -> iStatus.Int();
       
   604     if (err == KErrNone)
       
   605         {
       
   606         INFO_PRINTF1(_L("Expected KErrNotSupported by now. Convert did not return any error."));
       
   607         delete iImageDecoder;
       
   608         iImageDecoder = NULL;
       
   609 
       
   610         // activeListener, destBitmap
       
   611         CleanupStack::PopAndDestroy(2, activeListener);
       
   612         User::Leave(KErrGeneral);
       
   613         }
       
   614     else
       
   615         {
       
   616         if(err== KErrNotSupported)
       
   617             {
       
   618             INFO_PRINTF1(_L("Got KErrNotSupported as expected"));
       
   619             }
       
   620         else
       
   621             {
       
   622             delete iImageDecoder;
       
   623             iImageDecoder = NULL;
       
   624 
       
   625             // activeListener, destBitmap
       
   626             CleanupStack::PopAndDestroy(2, activeListener);
       
   627             INFO_PRINTF1(_L("Unexpected error"));
       
   628             User::Leave(err);
       
   629             }
       
   630         }
       
   631 
       
   632    
       
   633 
       
   634     delete iImageDecoder;
       
   635     iImageDecoder = NULL;
       
   636 
       
   637     // activeListener, destBitmap
       
   638     CleanupStack::PopAndDestroy(2, activeListener);
       
   639 
       
   640     }
       
   641