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