os/mm/imagingandcamerafws/cameraunittest/src/TSU_ECM_ADV/ecamextendedfunctest.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
#include <ecamuids.hrh>
sl@0
    17
#include <w32std.h>
sl@0
    18
#include <ecom/ecomresolverparams.h>
sl@0
    19
#include "ecamextendedfunctest.h"
sl@0
    20
#include "ECamUnitTestPluginUids.hrh"
sl@0
    21
#include "ECamUnitTestPlugin.h"
sl@0
    22
#include <ecam/ecamcommonuids.hrh>
sl@0
    23
#include <fbs.h>
sl@0
    24
#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
sl@0
    25
#include <ecamconst.h>
sl@0
    26
#include "ecamdef.h"
sl@0
    27
#include <ecamcapturecontrolconst.h>
sl@0
    28
#endif
sl@0
    29
/*------------------------------------------------------
sl@0
    30
 	Client ViewFinder : RECamClientViewFinderTest
sl@0
    31
 *------------------------------------------------------*/
sl@0
    32
RECamClientViewFinderTest* RECamClientViewFinderTest::NewL(const TDesC& aTestStep)
sl@0
    33
	{
sl@0
    34
	RECamClientViewFinderTest* self = new (ELeave) RECamClientViewFinderTest(aTestStep);
sl@0
    35
	return self;	
sl@0
    36
	}
sl@0
    37
	
sl@0
    38
RECamClientViewFinderTest::RECamClientViewFinderTest(const TDesC& aTestStep)
sl@0
    39
	{
sl@0
    40
	iTestStepName.Copy(aTestStep);
sl@0
    41
	}
sl@0
    42
	
sl@0
    43
TVerdict RECamClientViewFinderTest::DoTestStepL()
sl@0
    44
	{
sl@0
    45
	if(!iTestStepName.Compare(_L("MM-ECM-ADV-U-050-HP")))
sl@0
    46
		{
sl@0
    47
		return DoTestStep_50L();
sl@0
    48
		}
sl@0
    49
	return EInconclusive;	
sl@0
    50
	}
sl@0
    51
	
sl@0
    52
TVerdict RECamClientViewFinderTest::DoTestStep_50L()
sl@0
    53
	{	
sl@0
    54
	TVerdict verdict = EFail;
sl@0
    55
	INFO_PRINTF1(_L("Alloc test"));
sl@0
    56
	TInt i;
sl@0
    57
	TInt err;
sl@0
    58
	for (i = 1 ; ; i++)
sl@0
    59
		{
sl@0
    60
		__MM_HEAP_MARK;
sl@0
    61
		
sl@0
    62
		if (i % 5 == 0)
sl@0
    63
			{
sl@0
    64
			INFO_PRINTF2(_L("Fail count = %d"), i);
sl@0
    65
			}
sl@0
    66
sl@0
    67
		__UHEAP_SETFAIL(RHeap::EFailNext, i);
sl@0
    68
sl@0
    69
		TRAP(err, verdict = DoClientVFTestStepL());
sl@0
    70
sl@0
    71
		TAny* testAlloc = User::Alloc(1);
sl@0
    72
		TBool heapTestingComplete = (testAlloc == NULL) && (err==KErrNone);
sl@0
    73
		User::Free(testAlloc);
sl@0
    74
sl@0
    75
		__UHEAP_RESET;
sl@0
    76
		__MM_HEAP_MARKEND;
sl@0
    77
sl@0
    78
		if ((err != KErrNoMemory ) || heapTestingComplete)
sl@0
    79
			{
sl@0
    80
			INFO_PRINTF4(_L("err = %d, verdict = %d, Fail count = %d"), err, verdict, i);
sl@0
    81
			INFO_PRINTF1(_L("Alloc testing completed successfully"));
sl@0
    82
			verdict = EPass;
sl@0
    83
			break;
sl@0
    84
			}
sl@0
    85
		}
sl@0
    86
	return verdict;
sl@0
    87
	}
sl@0
    88
	
sl@0
    89
TVerdict RECamClientViewFinderTest::DoClientVFTestStepL()
sl@0
    90
	{
sl@0
    91
	TVerdict result = EPass;
sl@0
    92
	CCamera* camera = NULL;
sl@0
    93
	
sl@0
    94
	MClientViewFinderObserver *clientVFObserver = NULL;
sl@0
    95
	TInt error = KErrNone;
sl@0
    96
	CCamera::CCameraClientViewFinder* clientVF = NULL;
sl@0
    97
	
sl@0
    98
	MCameraObserver* observer = NULL; 
sl@0
    99
		
sl@0
   100
	// using observer 	
sl@0
   101
	__MM_HEAP_MARK;
sl@0
   102
	INFO_PRINTF1(_L("Create camera using Camera::NewL() and MCameraObserver"));
sl@0
   103
	TRAP(error, camera = CCamera::NewL(*observer, 0));
sl@0
   104
	if (error==KErrNone)
sl@0
   105
		{
sl@0
   106
		CleanupStack::PushL(camera);
sl@0
   107
		INFO_PRINTF1(_L("Create client viewfinder from CCamera object"));
sl@0
   108
		
sl@0
   109
		TRAP(error, clientVF  = CCamera::CCameraClientViewFinder::NewL(*camera, *clientVFObserver));	
sl@0
   110
 		if (error==KErrExtensionNotSupported)
sl@0
   111
	    	{
sl@0
   112
	    	INFO_PRINTF1(_L("CCameraClientViewFinder object creation using old Observer failed with correct error"));
sl@0
   113
	    	}
sl@0
   114
	    else
sl@0
   115
    		{
sl@0
   116
    		INFO_PRINTF1(_L("CCameraClientViewFinder object creation using old Observer gave unexpected result"));
sl@0
   117
    		result = EFail;
sl@0
   118
    		}	
sl@0
   119
		CleanupStack::PopAndDestroy(camera);
sl@0
   120
		}
sl@0
   121
	else 
sl@0
   122
		{
sl@0
   123
		INFO_PRINTF2(_L("Unexpected %d return from CCamera::NewL()"), error);
sl@0
   124
		result = EFail;	
sl@0
   125
		User::Leave(KErrNoMemory);	
sl@0
   126
		}
sl@0
   127
	__MM_HEAP_MARKEND;
sl@0
   128
	
sl@0
   129
	// using observer2 with NewL 
sl@0
   130
	MCameraObserver2* observer2 = NULL;	
sl@0
   131
	__MM_HEAP_MARK;
sl@0
   132
	INFO_PRINTF1(_L("Create camera using Camera::NewL() and MCameraObserver2"));
sl@0
   133
	TRAP(error, camera = CCamera::NewL(*observer2, 0,0));
sl@0
   134
	if (error==KErrNone)
sl@0
   135
		{
sl@0
   136
		CleanupStack::PushL(camera);
sl@0
   137
		INFO_PRINTF1(_L("Create client viewfinder from CCamera object"));
sl@0
   138
		
sl@0
   139
		TRAP(error, clientVF  = CCamera::CCameraClientViewFinder::NewL(*camera, *clientVFObserver));	
sl@0
   140
 		if (error==KErrExtensionNotSupported)
sl@0
   141
	    	{
sl@0
   142
	    	INFO_PRINTF1(_L("CCameraClientViewFinder object creation using Observer2 with NewL failed with correct error"));
sl@0
   143
	    	}
sl@0
   144
	    else
sl@0
   145
    		{
sl@0
   146
    		INFO_PRINTF1(_L("CCameraClientViewFinder object creation using Observer2 with NewL gave unexpected result"));
sl@0
   147
    		result = EFail;
sl@0
   148
    		}	
sl@0
   149
		CleanupStack::PopAndDestroy(camera);
sl@0
   150
		}
sl@0
   151
	else 
sl@0
   152
		{
sl@0
   153
		INFO_PRINTF2(_L("Unexpected %d return from CCamera::NewL()"), error);
sl@0
   154
		result = EFail;	
sl@0
   155
		User::Leave(KErrNoMemory);	
sl@0
   156
		}
sl@0
   157
	__MM_HEAP_MARKEND;
sl@0
   158
		
sl@0
   159
	// create client viewfinder object using New2L
sl@0
   160
	__MM_HEAP_MARK;
sl@0
   161
	
sl@0
   162
	INFO_PRINTF1(_L("Create camera using Camera::New2L() and MCameraObserver2"));
sl@0
   163
	
sl@0
   164
	TRAP(error, camera = CCamera::New2L(*observer2, 0,0));
sl@0
   165
	if (error==KErrNone)
sl@0
   166
		{
sl@0
   167
		CleanupStack::PushL(camera);
sl@0
   168
		INFO_PRINTF1(_L("KErrNone return from CCamera::New2L()"));
sl@0
   169
		TRAP(error, clientVF  = CCamera::CCameraClientViewFinder::NewL(*camera, *clientVFObserver));	
sl@0
   170
		
sl@0
   171
		if (error==KErrNone)
sl@0
   172
	    	{
sl@0
   173
	    	CleanupStack::PushL(clientVF);
sl@0
   174
	  		INFO_PRINTF1(_L("CCameraClientViewFinder object was created using NewL")); 
sl@0
   175
	    	
sl@0
   176
	    	INFO_PRINTF1(_L("Create Histogram for Client ViewFinder"));
sl@0
   177
	  		CCamera::CCameraV2Histogram* histogram_CVF = clientVF->CreateHistogramHandleL();
sl@0
   178
	  		if(!histogram_CVF)
sl@0
   179
	  			{
sl@0
   180
	  			INFO_PRINTF1(_L("Histogram creation for Client ViewFinder unsuccessful"));
sl@0
   181
	  			result = EFail;
sl@0
   182
	  			User::Leave(KErrNoMemory);
sl@0
   183
	  			}
sl@0
   184
	  			
sl@0
   185
	  		CleanupStack::PushL(histogram_CVF);
sl@0
   186
	  		INFO_PRINTF1(_L("Histogram object was created for Client ViewFinder"));
sl@0
   187
	  		CleanupStack::PopAndDestroy(histogram_CVF);
sl@0
   188
	    	
sl@0
   189
	    	CleanupStack::PopAndDestroy(clientVF);
sl@0
   190
	    	}
sl@0
   191
	    else
sl@0
   192
    		{
sl@0
   193
    		INFO_PRINTF1(_L("CCameraClientViewFinder object was not created using NewL")); 
sl@0
   194
    		result = EFail;
sl@0
   195
    		User::Leave(KErrNoMemory);
sl@0
   196
    		}	
sl@0
   197
		CleanupStack::PopAndDestroy(camera);
sl@0
   198
		}
sl@0
   199
	else 
sl@0
   200
		{
sl@0
   201
		INFO_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
sl@0
   202
		result = EFail;	
sl@0
   203
		User::Leave(KErrNoMemory);	
sl@0
   204
		}
sl@0
   205
	__MM_HEAP_MARKEND;
sl@0
   206
   
sl@0
   207
	return result;
sl@0
   208
	}
sl@0
   209
	
sl@0
   210
/*------------------------------------------------------
sl@0
   211
 	Client ViewFinder : RECamClientVFNotificationTest
sl@0
   212
 *------------------------------------------------------*/
sl@0
   213
RECamClientVFNotificationTest* RECamClientVFNotificationTest::NewL(TBool aAllocTest)
sl@0
   214
	{
sl@0
   215
	RECamClientVFNotificationTest* self = new (ELeave) RECamClientVFNotificationTest(aAllocTest);
sl@0
   216
	CleanupStack::PushL(self);
sl@0
   217
	self->ConstructL();
sl@0
   218
	CleanupStack::Pop(self);
sl@0
   219
	return self;	
sl@0
   220
	}
sl@0
   221
	
sl@0
   222
void RECamClientVFNotificationTest::ConstructL()
sl@0
   223
	{
sl@0
   224
	}
sl@0
   225
	
sl@0
   226
RECamClientVFNotificationTest::RECamClientVFNotificationTest(TBool /*aAllocTest*/)
sl@0
   227
	{
sl@0
   228
	iTestStepName = _L("MM-ECM-ADV-U-051-HP");
sl@0
   229
	}
sl@0
   230
	
sl@0
   231
void RECamClientVFNotificationTest::ViewFinderBufferReady(CCamera::CCameraClientViewFinder& aClientViewFinderHandle, TInt aErrorCode)
sl@0
   232
	{
sl@0
   233
	aClientViewFinderHandle.GetViewFinderHandleL(iVFHandle);
sl@0
   234
	iError = aErrorCode;
sl@0
   235
	}
sl@0
   236
sl@0
   237
void RECamClientVFNotificationTest::DirectHistogramDisplayed(CCamera::CCameraClientViewFinder& aClientViewFinderHandle, CCamera::CCameraV2Histogram& /*aDirectHistogramDisplayed*/, TInt aErrorCode)
sl@0
   238
	{
sl@0
   239
	aClientViewFinderHandle.GetViewFinderHandleL(iVFHandle);
sl@0
   240
	iError = aErrorCode;
sl@0
   241
	}
sl@0
   242
sl@0
   243
void RECamClientVFNotificationTest::ClientHistogramReady(CCamera::CCameraClientViewFinder& aClientViewFinderHandle, MHistogramV2Buffer* /*aClientHistogramBuffer*/, TInt aErrorCode)
sl@0
   244
	{
sl@0
   245
	aClientViewFinderHandle.GetViewFinderHandleL(iVFHandle);
sl@0
   246
	iError = aErrorCode;
sl@0
   247
	}
sl@0
   248
	
sl@0
   249
void RECamClientVFNotificationTest::ImageProcessingFailed(CCamera::CCameraClientViewFinder& aClientViewFinderHandle, TInt aErrorCode)
sl@0
   250
	{
sl@0
   251
	aClientViewFinderHandle.GetViewFinderHandleL(iVFHandle);
sl@0
   252
	iError = aErrorCode;	
sl@0
   253
	}
sl@0
   254
	
sl@0
   255
TInt RECamClientVFNotificationTest::CustomInterface(TUid /*aInterface*/, TAny*& /*aPtrInterface*/)
sl@0
   256
	{
sl@0
   257
	return KErrNone;
sl@0
   258
	}
sl@0
   259
sl@0
   260
void RECamClientVFNotificationTest::CheckViewFinderNegNotification(TInt aVFHandle, TVerdict& aResult)	
sl@0
   261
	{
sl@0
   262
	INFO_PRINTF4(_L("Expected ClientViewFinder Id %d, received event %x. Error %d."), aVFHandle, iVFHandle, iError); 
sl@0
   263
	if (aVFHandle != iVFHandle || iError != KErrNotSupported)
sl@0
   264
		{
sl@0
   265
	    aResult = EFail;
sl@0
   266
	    }
sl@0
   267
	}
sl@0
   268
	
sl@0
   269
TVerdict RECamClientVFNotificationTest::DoTestStepL()
sl@0
   270
	{
sl@0
   271
	TVerdict verdict = EFail;
sl@0
   272
	INFO_PRINTF1(_L("Alloc test"));
sl@0
   273
	TInt i;
sl@0
   274
	TInt err;
sl@0
   275
	for (i = 1 ; ; i++)
sl@0
   276
		{
sl@0
   277
		__MM_HEAP_MARK;
sl@0
   278
		
sl@0
   279
		if (i % 5 == 0)
sl@0
   280
			{
sl@0
   281
			INFO_PRINTF2(_L("Fail count = %d"), i);
sl@0
   282
			}
sl@0
   283
sl@0
   284
		__UHEAP_SETFAIL(RHeap::EFailNext, i);
sl@0
   285
sl@0
   286
		TRAP(err, verdict = DoTestStepL_51L());
sl@0
   287
sl@0
   288
		TAny* testAlloc = User::Alloc(1);
sl@0
   289
		TBool heapTestingComplete = (testAlloc == NULL) && (err==KErrNone);
sl@0
   290
		User::Free(testAlloc);
sl@0
   291
sl@0
   292
		__UHEAP_RESET;
sl@0
   293
		__MM_HEAP_MARKEND;
sl@0
   294
sl@0
   295
		if ((err != KErrNoMemory && verdict == EPass ) || heapTestingComplete)
sl@0
   296
			{
sl@0
   297
			INFO_PRINTF4(_L("err = %d, verdict = %d, Fail count = %d"), err, verdict, i);
sl@0
   298
			INFO_PRINTF1(_L("Alloc testing completed successfully"));
sl@0
   299
			verdict = EPass;
sl@0
   300
			break;
sl@0
   301
			}
sl@0
   302
		}
sl@0
   303
	return verdict;
sl@0
   304
	}
sl@0
   305
	
sl@0
   306
TVerdict RECamClientVFNotificationTest::DoTestStepL_51L()
sl@0
   307
	{
sl@0
   308
	TVerdict result = EPass;
sl@0
   309
	CCamera* camera = NULL;
sl@0
   310
	
sl@0
   311
	TInt error = KErrNone;
sl@0
   312
	CCamera::CCameraClientViewFinder* clientVF = NULL;
sl@0
   313
sl@0
   314
/**************************************************************/	
sl@0
   315
	MCameraObserver2* observer2 = NULL;	
sl@0
   316
	__MM_HEAP_MARK;
sl@0
   317
	INFO_PRINTF1(_L("Create camera using Camera::NewL() and MCameraObserver2"));
sl@0
   318
	TRAP(error, camera = CCamera::NewL(*observer2, 0,0));
sl@0
   319
	if (error==KErrNone)
sl@0
   320
		{
sl@0
   321
		CleanupStack::PushL(camera);
sl@0
   322
		INFO_PRINTF1(_L("Create client viewfinder from CCamera object"));
sl@0
   323
		
sl@0
   324
		TRAP(error, clientVF  = CCamera::CCameraClientViewFinder::NewL(*camera, *this));	
sl@0
   325
 		
sl@0
   326
 		if (error == KErrNone)
sl@0
   327
 			{
sl@0
   328
 			INFO_PRINTF1(_L("CCameraClientViewFinder object creation using Observer2 with NewL is successful."));
sl@0
   329
 			}
sl@0
   330
 		else if (error==KErrExtensionNotSupported)
sl@0
   331
	    	{
sl@0
   332
	    	INFO_PRINTF1(_L("CCameraClientViewFinder object creation using Observer2 with NewL failed with correct error"));
sl@0
   333
	    	}
sl@0
   334
	    else
sl@0
   335
    		{
sl@0
   336
    		INFO_PRINTF1(_L("CCameraClientViewFinder object creation using Observer2 with NewL gave unexpected result"));
sl@0
   337
    		result = EFail;
sl@0
   338
    		}
sl@0
   339
		CleanupStack::PopAndDestroy(camera);
sl@0
   340
		}
sl@0
   341
	else 
sl@0
   342
		{
sl@0
   343
		INFO_PRINTF2(_L("Unexpected %d return from CCamera::NewL()"), error);
sl@0
   344
		result = EFail;	
sl@0
   345
		User::Leave(KErrNoMemory);	
sl@0
   346
		}
sl@0
   347
	__MM_HEAP_MARKEND;
sl@0
   348
/**************************************************************/
sl@0
   349
	
sl@0
   350
	// create client viewfinder object using New2L
sl@0
   351
	__MM_HEAP_MARK;
sl@0
   352
	INFO_PRINTF1(_L("Create camera using Camera::New2L() and MCameraObserver2"));
sl@0
   353
	
sl@0
   354
	TRAP(error, camera = CCamera::New2L(*this, 0, 0));
sl@0
   355
sl@0
   356
	if (error==KErrNone)
sl@0
   357
		{
sl@0
   358
		CleanupStack::PushL(camera);
sl@0
   359
		INFO_PRINTF1(_L("KErrNone return from CCamera::New2L()"));
sl@0
   360
		TRAP(error, clientVF  = CCamera::CCameraClientViewFinder::NewL(*camera, *this));	
sl@0
   361
		
sl@0
   362
		if (error==KErrNone)
sl@0
   363
	    	{
sl@0
   364
	    	CleanupStack::PushL(clientVF);
sl@0
   365
	  		INFO_PRINTF1(_L("CCameraClientViewFinder object was created using NewL")); 
sl@0
   366
	  		//Test Client ViewFinder APIs
sl@0
   367
	  		INFO_PRINTF1(_L("Create Histogram for Client ViewFinder"));
sl@0
   368
	  		CCamera::CCameraV2Histogram* histogram_CVF = clientVF->CreateHistogramHandleL();
sl@0
   369
	  		if(!histogram_CVF)
sl@0
   370
	  			{
sl@0
   371
	  			INFO_PRINTF1(_L("Histogram creation for Client ViewFinder unsuccessful"));
sl@0
   372
	  			result = EFail;
sl@0
   373
	  			}
sl@0
   374
	  			
sl@0
   375
	  		CleanupStack::PushL(histogram_CVF);
sl@0
   376
	  			
sl@0
   377
	  		INFO_PRINTF1(_L("Create ImageProcessing for Client ViewFinder"));
sl@0
   378
	  		
sl@0
   379
	  		TRAPD(err, clientVF->GetTransformationHandleL());
sl@0
   380
  			if(err != KErrNotSupported)
sl@0
   381
  				{
sl@0
   382
  				INFO_PRINTF1(_L("ImageProcessing creation for Client ViewFinder: unexpected result!"));
sl@0
   383
  				result = EFail;
sl@0
   384
  				}
sl@0
   385
	  		
sl@0
   386
	  		//set properties for client VF (base class)
sl@0
   387
	  		INFO_PRINTF1(_L("GetViewFinderFadingCapabilitiesL for Client ViewFinder"));
sl@0
   388
	  		CCameraViewFinder::TViewFinderFadingCapabilities fadingCapabilities;
sl@0
   389
	  		TRAP(err,clientVF->GetViewFinderFadingCapabilitiesL(fadingCapabilities));
sl@0
   390
  			if(err != KErrNotSupported)
sl@0
   391
  				{
sl@0
   392
  				INFO_PRINTF1(_L("GetViewFinderFadingCapabilitiesL for Client ViewFinder: unexpected result!"));
sl@0
   393
  				result = EFail;
sl@0
   394
  				}
sl@0
   395
	  			
sl@0
   396
	  		INFO_PRINTF1(_L("GetViewFinderFadingEffectL for Client ViewFinder"));
sl@0
   397
	  		CCameraViewFinder::TViewFinderFadingEffect fadingEffect;
sl@0
   398
	  		TRAP(err,clientVF->GetViewFinderFadingEffectL(fadingEffect));
sl@0
   399
  			if(err != KErrNotSupported)
sl@0
   400
  				{
sl@0
   401
  				INFO_PRINTF1(_L("GetViewFinderFadingEffectL for Client ViewFinder: unexpected result!"));
sl@0
   402
  				result = EFail;
sl@0
   403
  				}
sl@0
   404
	
sl@0
   405
			INFO_PRINTF1(_L("SetViewFinderFadingEffectL for Client ViewFinder"));
sl@0
   406
			iInputEventUid = KUidECamEvent2ViewFinderFadingEffect;
sl@0
   407
			clientVF->SetViewFinderFadingEffectL(fadingEffect);
sl@0
   408
			CheckNotificationNeg(iInputEventUid, result);
sl@0
   409
			
sl@0
   410
			TInt vfHandle=-1;
sl@0
   411
			clientVF->GetViewFinderHandleL(vfHandle);
sl@0
   412
	  	
sl@0
   413
	  		//set properties for histogram (for viewfinder)
sl@0
   414
	  		TUint supportedHistogramType=0;
sl@0
   415
	  		histogram_CVF->GetSupportedHistogramsL(supportedHistogramType);
sl@0
   416
	  		if(supportedHistogramType!=0)
sl@0
   417
	  			{
sl@0
   418
	  			INFO_PRINTF1(_L("unexpected GetSupportedHistogramsL"));
sl@0
   419
	  			result = EFail;
sl@0
   420
	  			}
sl@0
   421
	  			
sl@0
   422
	  		INFO_PRINTF1(_L("GetDirectHistogramSupportInfoL for Histogram for Client ViewFinder"));
sl@0
   423
	  		TBool directHistogramSupported = EFalse;
sl@0
   424
	  		TRAP(err,histogram_CVF->GetDirectHistogramSupportInfoL(directHistogramSupported));
sl@0
   425
  			if(err != KErrNotSupported)
sl@0
   426
  				{
sl@0
   427
  				INFO_PRINTF1(_L("GetDirectHistogramSupportInfoL for Histogram for Client ViewFinder: unexpected result!"));
sl@0
   428
  				result = EFail;
sl@0
   429
  				}
sl@0
   430
	  			
sl@0
   431
	  		INFO_PRINTF1(_L("PrepareClientHistogramL for Histogram for Client ViewFinder"));
sl@0
   432
	  		CCamera::CCameraV2Histogram::THistogramType histogramType = CCamera::CCameraV2Histogram::EHistNone;
sl@0
   433
	  		TRAP(err,histogram_CVF->PrepareClientHistogramL(histogramType));
sl@0
   434
  			if(err != KErrNotSupported)
sl@0
   435
  				{
sl@0
   436
  				INFO_PRINTF1(_L("PrepareClientHistogramL for Histogram for Client ViewFinder: unexpected result!"));
sl@0
   437
  				result = EFail;
sl@0
   438
  				}
sl@0
   439
	  		
sl@0
   440
	  		INFO_PRINTF1(_L("PrepareDirectHistogramL for Histogram for Client ViewFinder"));
sl@0
   441
	  		CCamera::CCameraV2Histogram::TDirectHistogramParameters histogramParameters;
sl@0
   442
	  		TRAP(err,histogram_CVF->PrepareDirectHistogramL(histogramParameters));
sl@0
   443
  			if(err != KErrNotSupported)
sl@0
   444
  				{
sl@0
   445
  				INFO_PRINTF1(_L("PrepareDirectHistogramL for Histogram for Client ViewFinder: unexpected result!"));
sl@0
   446
  				result = EFail;
sl@0
   447
  				}
sl@0
   448
	  			
sl@0
   449
	  		INFO_PRINTF1(_L("UpdateDirectHistogramPropertiesL for Histogram for Client ViewFinder"));
sl@0
   450
	   		TRAP(err,histogram_CVF->UpdateDirectHistogramPropertiesL(histogramParameters));
sl@0
   451
  			if(err != KErrNotSupported)
sl@0
   452
  				{
sl@0
   453
  				INFO_PRINTF1(_L("UpdateDirectHistogramPropertiesL for Histogram for Client ViewFinder: unexpected result!"));
sl@0
   454
  				result = EFail;
sl@0
   455
  				}
sl@0
   456
	  			
sl@0
   457
	  		INFO_PRINTF1(_L("GetDirectHistogramPropertiesL for Histogram for Client ViewFinder"));
sl@0
   458
	   		TRAP(err,histogram_CVF->GetDirectHistogramPropertiesL(histogramParameters));
sl@0
   459
  			if(err != KErrNotSupported)
sl@0
   460
  				{
sl@0
   461
  				INFO_PRINTF1(_L("GetDirectHistogramPropertiesL for Histogram for Client ViewFinder: unexpected result!"));
sl@0
   462
  				result = EFail;
sl@0
   463
  				}
sl@0
   464
	  			
sl@0
   465
			INFO_PRINTF1(_L("GetHistogramStateL for Histogram for Client ViewFinder"));
sl@0
   466
	   		TBool histogramActive = EFalse;
sl@0
   467
	   		TRAP(err,histogram_CVF->GetHistogramStateL(histogramActive));
sl@0
   468
  			if(err != KErrNotSupported)
sl@0
   469
  				{
sl@0
   470
  				INFO_PRINTF1(_L("GetHistogramStateL for Histogram for Client ViewFinder: unexpected result!"));
sl@0
   471
  				result = EFail;
sl@0
   472
  				}
sl@0
   473
			
sl@0
   474
  			//viewfinder starting...
sl@0
   475
  			INFO_PRINTF1(_L("StartClientViewFinderL for Client ViewFinder"));
sl@0
   476
			TSize size(320,240);
sl@0
   477
  			TRAP(err,clientVF->StartClientViewFinderL(0, CCamera::EFormatFbsBitmapColor64K, size));
sl@0
   478
  			if(err != KErrNone)
sl@0
   479
  				{
sl@0
   480
  				INFO_PRINTF1(_L("StartClientViewFinderL for Client ViewFinder: unexpected result!"));
sl@0
   481
  				result = EFail;
sl@0
   482
  				}
sl@0
   483
			CheckViewFinderNegNotification(vfHandle, result);
sl@0
   484
			
sl@0
   485
			INFO_PRINTF1(_L("GetViewFinderBufferL for Client ViewFinder"));
sl@0
   486
			CFbsBitmap* bitmap = new(ELeave) CFbsBitmap;
sl@0
   487
			CleanupStack::PushL(bitmap);
sl@0
   488
			RCamBuffer2 cameraVFBuffer(bitmap);
sl@0
   489
			TRAP(err,clientVF->GetViewFinderBufferL(cameraVFBuffer));
sl@0
   490
			if(err != KErrNotSupported)
sl@0
   491
  				{
sl@0
   492
  				INFO_PRINTF1(_L("GetViewFinderBufferL for Client ViewFinder: unexpected result!"));
sl@0
   493
  				result = EFail;
sl@0
   494
  				}
sl@0
   495
  			CleanupStack::PopAndDestroy(bitmap);
sl@0
   496
			
sl@0
   497
			TRect clipRect(TPoint(0,0),size);
sl@0
   498
			TRAP(err,clientVF->StartClientViewFinderL(0, CCamera::EFormatFbsBitmapColor64K, size, clipRect));
sl@0
   499
			if(err != KErrNone)
sl@0
   500
  				{
sl@0
   501
  				INFO_PRINTF1(_L("StartClientViewFinderL for Client ViewFinder: unexpected result!"));
sl@0
   502
  				result = EFail;
sl@0
   503
  				}
sl@0
   504
			CheckViewFinderNegNotification(vfHandle, result);
sl@0
   505
			
sl@0
   506
			INFO_PRINTF1(_L("GetClientViewFinderStateL for Client ViewFinder"));
sl@0
   507
			TBool activeVF = EFalse;;
sl@0
   508
			TRAP(err,clientVF->GetClientViewFinderStateL(activeVF));
sl@0
   509
			if(err != KErrNotSupported)
sl@0
   510
  				{
sl@0
   511
  				INFO_PRINTF1(_L("GetClientViewFinderStateL for Client ViewFinder: unexpected result!"));
sl@0
   512
  				result = EFail;
sl@0
   513
  				}
sl@0
   514
			
sl@0
   515
			INFO_PRINTF1(_L("StartHistogram for Client ViewFinder"));
sl@0
   516
			histogram_CVF->StartHistogram();
sl@0
   517
			CheckViewFinderNegNotification(vfHandle, result);
sl@0
   518
	  		
sl@0
   519
	  		INFO_PRINTF1(_L("StopHistogram for Client ViewFinder"));	
sl@0
   520
			histogram_CVF->StopHistogram();
sl@0
   521
			
sl@0
   522
			INFO_PRINTF1(_L("GetClientViewFinderPropertiesL for Client ViewFinder"));	
sl@0
   523
			TInt screenNumber=0;
sl@0
   524
			CCamera::TFormat imageFormat=CCamera::EFormatFbsBitmapColor64K;
sl@0
   525
			TRAP(err,clientVF->GetClientViewFinderPropertiesL(screenNumber, imageFormat, size, clipRect));
sl@0
   526
			if(err != KErrNotSupported)
sl@0
   527
  				{
sl@0
   528
  				INFO_PRINTF1(_L("GetClientViewFinderPropertiesL for Client ViewFinder: unexpected result!"));
sl@0
   529
  				result = EFail;
sl@0
   530
  				}
sl@0
   531
  				
sl@0
   532
  			INFO_PRINTF1(_L("StopClientViewFinder for Client ViewFinder"));		
sl@0
   533
			clientVF->StopClientViewFinder();
sl@0
   534
	
sl@0
   535
  			CleanupStack::PopAndDestroy(histogram_CVF);
sl@0
   536
	    	CleanupStack::PopAndDestroy(clientVF);
sl@0
   537
	    	}
sl@0
   538
	    else
sl@0
   539
    		{
sl@0
   540
    		INFO_PRINTF1(_L("CCameraClientViewFinder object not created")); 
sl@0
   541
    		result = EFail;
sl@0
   542
    		}	
sl@0
   543
		CleanupStack::PopAndDestroy(camera);
sl@0
   544
		}
sl@0
   545
	else 
sl@0
   546
		{
sl@0
   547
		INFO_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
sl@0
   548
		result = EFail;		
sl@0
   549
		}
sl@0
   550
	__MM_HEAP_MARKEND;
sl@0
   551
   
sl@0
   552
	return result;	
sl@0
   553
	}
sl@0
   554
	
sl@0
   555
/*------------------------------------------------------
sl@0
   556
 	Direct ViewFinder : RECamV2DirectViewFinderTest
sl@0
   557
 *------------------------------------------------------*/
sl@0
   558
RECamV2DirectViewFinderTest* RECamV2DirectViewFinderTest::NewL(const TDesC& aTestStep)
sl@0
   559
	{
sl@0
   560
	RECamV2DirectViewFinderTest* self = new (ELeave) RECamV2DirectViewFinderTest(aTestStep);
sl@0
   561
	return self;	
sl@0
   562
	}
sl@0
   563
	
sl@0
   564
RECamV2DirectViewFinderTest::RECamV2DirectViewFinderTest(const TDesC& aTestStep)
sl@0
   565
	{
sl@0
   566
	iTestStepName.Copy(aTestStep);
sl@0
   567
	}
sl@0
   568
	
sl@0
   569
TVerdict RECamV2DirectViewFinderTest::DoTestStepL()
sl@0
   570
	{
sl@0
   571
	if(!iTestStepName.Compare(_L("MM-ECM-ADV-U-052-HP")))
sl@0
   572
		{
sl@0
   573
		return DoTestStep_52L();
sl@0
   574
		}
sl@0
   575
	return EInconclusive;	
sl@0
   576
	}
sl@0
   577
	
sl@0
   578
TVerdict RECamV2DirectViewFinderTest::DoTestStep_52L()
sl@0
   579
	{	
sl@0
   580
	TVerdict verdict = EFail;
sl@0
   581
	INFO_PRINTF1(_L("Alloc test"));
sl@0
   582
	TInt i;
sl@0
   583
	TInt err;
sl@0
   584
	for (i = 1 ; ; i++)
sl@0
   585
		{
sl@0
   586
		__MM_HEAP_MARK;
sl@0
   587
		
sl@0
   588
		if (i % 5 == 0)
sl@0
   589
			{
sl@0
   590
			INFO_PRINTF2(_L("Fail count = %d"), i);
sl@0
   591
			}
sl@0
   592
sl@0
   593
		__UHEAP_SETFAIL(RHeap::EFailNext, i);
sl@0
   594
sl@0
   595
		TRAP(err, verdict = DoV2DirectVFTestStepL());
sl@0
   596
sl@0
   597
		TAny* testAlloc = User::Alloc(1);
sl@0
   598
		TBool heapTestingComplete = (testAlloc == NULL) && (err==KErrNone);
sl@0
   599
		User::Free(testAlloc);
sl@0
   600
sl@0
   601
		__UHEAP_RESET;
sl@0
   602
		__MM_HEAP_MARKEND;
sl@0
   603
sl@0
   604
		if ((err != KErrNoMemory ) || heapTestingComplete)
sl@0
   605
			{
sl@0
   606
			INFO_PRINTF4(_L("err = %d, verdict = %d, Fail count = %d"), err, verdict, i);
sl@0
   607
			INFO_PRINTF1(_L("Alloc testing completed successfully"));
sl@0
   608
			verdict = EPass;
sl@0
   609
			break;
sl@0
   610
			}
sl@0
   611
		}
sl@0
   612
	return verdict;
sl@0
   613
	}
sl@0
   614
	
sl@0
   615
TVerdict RECamV2DirectViewFinderTest::DoV2DirectVFTestStepL()
sl@0
   616
	{
sl@0
   617
	TVerdict result = EPass;
sl@0
   618
	CCamera* camera = NULL;
sl@0
   619
	
sl@0
   620
	MCameraObserver* observer = NULL;
sl@0
   621
	MDirectViewFinderObserver* directVFObserver = NULL;
sl@0
   622
	
sl@0
   623
	TInt error = KErrNone;
sl@0
   624
	CCamera::CCameraV2DirectViewFinder* directVF = NULL;
sl@0
   625
	
sl@0
   626
	// using observer 	
sl@0
   627
	__MM_HEAP_MARK;
sl@0
   628
	INFO_PRINTF1(_L("Create camera using Camera::NewL() and MCameraObserver"));
sl@0
   629
	TRAP(error, camera = CCamera::NewL(*observer, 0));
sl@0
   630
	if (error==KErrNone)
sl@0
   631
		{
sl@0
   632
		CleanupStack::PushL(camera);
sl@0
   633
		INFO_PRINTF1(_L("Create v2 direct viewfinder from CCamera object"));
sl@0
   634
		
sl@0
   635
		TRAP(error, directVF  = CCamera::CCameraV2DirectViewFinder::NewL(*camera, *directVFObserver));	
sl@0
   636
 		if (error==KErrExtensionNotSupported)
sl@0
   637
	    	{
sl@0
   638
	    	INFO_PRINTF1(_L("CCameraV2DirectViewFinder object creation using old Observer failed with correct error"));
sl@0
   639
	    	}
sl@0
   640
	    else
sl@0
   641
    		{
sl@0
   642
    		INFO_PRINTF1(_L("CCameraV2DirectViewFinder object creation using old Observer gave unexpected result"));
sl@0
   643
    		result = EFail;
sl@0
   644
    		}	
sl@0
   645
		CleanupStack::PopAndDestroy(camera);
sl@0
   646
		}
sl@0
   647
	else 
sl@0
   648
		{
sl@0
   649
		INFO_PRINTF2(_L("Unexpected %d return from CCamera::NewL()"), error);
sl@0
   650
		result = EFail;	
sl@0
   651
		User::Leave(KErrNoMemory);	
sl@0
   652
		}
sl@0
   653
	__MM_HEAP_MARKEND;
sl@0
   654
	
sl@0
   655
	// using observer2 with NewL 
sl@0
   656
	MCameraObserver2* observer2 = NULL;	
sl@0
   657
	__MM_HEAP_MARK;
sl@0
   658
	INFO_PRINTF1(_L("Create camera using Camera::NewL() and MCameraObserver2"));
sl@0
   659
	TRAP(error, camera = CCamera::NewL(*observer2, 0,0));
sl@0
   660
	if (error==KErrNone)
sl@0
   661
		{
sl@0
   662
		CleanupStack::PushL(camera);
sl@0
   663
		INFO_PRINTF1(_L("Create v2 direct viewfinder from CCamera object"));
sl@0
   664
		
sl@0
   665
		TRAP(error, directVF  = CCamera::CCameraV2DirectViewFinder::NewL(*camera, *directVFObserver));	
sl@0
   666
 		if (error==KErrExtensionNotSupported)
sl@0
   667
	    	{
sl@0
   668
	    	INFO_PRINTF1(_L("CCameraV2DirectViewFinder object creation using Observer2 with NewL failed with correct error"));
sl@0
   669
	    	}
sl@0
   670
	    else
sl@0
   671
    		{
sl@0
   672
    		INFO_PRINTF1(_L("CCameraV2DirectViewFinder object creation using Observer2 with NewL gave unexpected result"));
sl@0
   673
    		result = EFail;
sl@0
   674
    		}	
sl@0
   675
		CleanupStack::PopAndDestroy(camera);
sl@0
   676
		}
sl@0
   677
	else 
sl@0
   678
		{
sl@0
   679
		INFO_PRINTF2(_L("Unexpected %d return from CCamera::NewL()"), error);
sl@0
   680
		result = EFail;	
sl@0
   681
		User::Leave(KErrNoMemory);	
sl@0
   682
		}
sl@0
   683
	__MM_HEAP_MARKEND;
sl@0
   684
	
sl@0
   685
	// create v2 direct viewfinder object using New2L
sl@0
   686
	__MM_HEAP_MARK;
sl@0
   687
	INFO_PRINTF1(_L("Create camera using Camera::New2L() and MCameraObserver2"));
sl@0
   688
	
sl@0
   689
	TRAP(error, camera = CCamera::New2L(*observer2, 0,0));
sl@0
   690
	if (error==KErrNone)
sl@0
   691
		{
sl@0
   692
		CleanupStack::PushL(camera);
sl@0
   693
		INFO_PRINTF1(_L("KErrNone return from CCamera::New2L()"));
sl@0
   694
		TRAP(error, directVF = CCamera::CCameraV2DirectViewFinder::NewL(*camera, *directVFObserver));	
sl@0
   695
		
sl@0
   696
		if (error==KErrNone)
sl@0
   697
	    	{
sl@0
   698
	    	CleanupStack::PushL(directVF);
sl@0
   699
	  		INFO_PRINTF1(_L("CCameraV2DirectViewFinder object was created using NewL")); 
sl@0
   700
	    	CleanupStack::PopAndDestroy(directVF);
sl@0
   701
	    	}
sl@0
   702
	    else
sl@0
   703
    		{
sl@0
   704
    		INFO_PRINTF1(_L("CCameraV2DirectViewFinder object was not created using NewL")); 
sl@0
   705
    		result = EFail;
sl@0
   706
    		User::Leave(KErrNoMemory);
sl@0
   707
    		}	
sl@0
   708
		CleanupStack::PopAndDestroy(camera);
sl@0
   709
		}
sl@0
   710
	else 
sl@0
   711
		{
sl@0
   712
		INFO_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
sl@0
   713
		result = EFail;
sl@0
   714
		User::Leave(KErrNoMemory);		
sl@0
   715
		}
sl@0
   716
	__MM_HEAP_MARKEND;
sl@0
   717
   
sl@0
   718
	return result;
sl@0
   719
	}
sl@0
   720
sl@0
   721
/*------------------------------------------------------
sl@0
   722
 	Direct ViewFinder : RECamV2DirectVFNotificationTest
sl@0
   723
 *------------------------------------------------------*/
sl@0
   724
RECamV2DirectVFNotificationTest* RECamV2DirectVFNotificationTest::NewL(TBool aAllocTest)
sl@0
   725
	{
sl@0
   726
	RECamV2DirectVFNotificationTest* self = new (ELeave) RECamV2DirectVFNotificationTest(aAllocTest);
sl@0
   727
	CleanupStack::PushL(self);
sl@0
   728
	self->ConstructL();
sl@0
   729
	CleanupStack::Pop(self);
sl@0
   730
	return self;	
sl@0
   731
	}
sl@0
   732
	
sl@0
   733
void RECamV2DirectVFNotificationTest::ConstructL()
sl@0
   734
	{
sl@0
   735
	}
sl@0
   736
	
sl@0
   737
RECamV2DirectVFNotificationTest::RECamV2DirectVFNotificationTest(TBool /*aAllocTest*/)
sl@0
   738
	{
sl@0
   739
	iTestStepName = _L("MM-ECM-ADV-U-053-HP");
sl@0
   740
	}
sl@0
   741
	
sl@0
   742
void RECamV2DirectVFNotificationTest::DirectViewFinderFirstFrameDisplayed(CCamera::CCameraV2DirectViewFinder& aDirectViewFinderHandle, TInt aErrorCode)
sl@0
   743
	{
sl@0
   744
	aDirectViewFinderHandle.GetViewFinderHandleL(iVFHandle);
sl@0
   745
	iError = aErrorCode;
sl@0
   746
	}
sl@0
   747
sl@0
   748
void RECamV2DirectVFNotificationTest::DirectHistogramDisplayed(CCamera::CCameraV2DirectViewFinder& aDirectViewFinderHandle, CCamera::CCameraV2Histogram& /*aDirectHistogramDisplayed*/, TInt aErrorCode)
sl@0
   749
	{
sl@0
   750
	aDirectViewFinderHandle.GetViewFinderHandleL(iVFHandle);
sl@0
   751
	iError = aErrorCode;
sl@0
   752
	}
sl@0
   753
sl@0
   754
void RECamV2DirectVFNotificationTest::ClientHistogramReady(CCamera::CCameraV2DirectViewFinder& aDirectViewFinderHandle, MHistogramV2Buffer* /*aClientHistogramBuffer*/, TInt aErrorCode)
sl@0
   755
	{
sl@0
   756
	aDirectViewFinderHandle.GetViewFinderHandleL(iVFHandle);
sl@0
   757
	iError = aErrorCode;
sl@0
   758
	}
sl@0
   759
	
sl@0
   760
void RECamV2DirectVFNotificationTest::DirectViewFinderFailed(CCamera::CCameraV2DirectViewFinder& aDirectViewFinderHandle, TInt aErrorCode)
sl@0
   761
	{
sl@0
   762
	aDirectViewFinderHandle.GetViewFinderHandleL(iVFHandle);
sl@0
   763
	iError = aErrorCode;	
sl@0
   764
	}
sl@0
   765
	
sl@0
   766
void RECamV2DirectVFNotificationTest::DirectSnapshotForImageDisplayed(CCamera::CCameraV2DirectViewFinder& aDirectViewFinderHandle, CCamera::CCameraImageCapture& /*aCaptureImageHandle*/, TPostCaptureControlId /*aPostCaptureControlId*/, TInt aErrorCode)
sl@0
   767
	{
sl@0
   768
	aDirectViewFinderHandle.GetViewFinderHandleL(iVFHandle);
sl@0
   769
	iError = aErrorCode;
sl@0
   770
	}
sl@0
   771
	
sl@0
   772
TInt RECamV2DirectVFNotificationTest::CustomInterface(TUid /*aInterface*/, TAny*& /*aPtrInterface*/)
sl@0
   773
	{
sl@0
   774
	return KErrNone;
sl@0
   775
	}
sl@0
   776
sl@0
   777
void RECamV2DirectVFNotificationTest::CheckViewFinderNegNotification(TInt aVFHandle, TVerdict& aResult)	
sl@0
   778
	{
sl@0
   779
	INFO_PRINTF4(_L("Expected DirectViewFinder Id %d, received event %x. Error %d."), aVFHandle, iVFHandle, iError); 
sl@0
   780
	if (aVFHandle != iVFHandle || iError != KErrNotSupported)
sl@0
   781
		{
sl@0
   782
	    aResult = EFail;
sl@0
   783
	    }
sl@0
   784
	}
sl@0
   785
	
sl@0
   786
TVerdict RECamV2DirectVFNotificationTest::DoTestStepL()
sl@0
   787
	{
sl@0
   788
	TVerdict verdict = EFail;
sl@0
   789
	INFO_PRINTF1(_L("Alloc test"));
sl@0
   790
	
sl@0
   791
	TInt i, err;
sl@0
   792
	
sl@0
   793
	for (i =1; ;i++)
sl@0
   794
		{
sl@0
   795
		if (i % 5 == 0)
sl@0
   796
			{
sl@0
   797
			INFO_PRINTF2(_L("Fail count = %d"), i);
sl@0
   798
			}
sl@0
   799
sl@0
   800
		__UHEAP_SETFAIL(RHeap::EFailNext,i);
sl@0
   801
		__MM_HEAP_MARK;
sl@0
   802
sl@0
   803
		TRAP(err,verdict = DoTestStep_53L());
sl@0
   804
sl@0
   805
		TAny* testAlloc = User::Alloc(1);
sl@0
   806
		TBool heapTestingComplete = ((testAlloc == NULL ) && (err == KErrNone));
sl@0
   807
		User::Free(testAlloc);
sl@0
   808
sl@0
   809
		if ((err != KErrNoMemory && verdict == EPass) || heapTestingComplete)
sl@0
   810
			{
sl@0
   811
			INFO_PRINTF4(_L("err = %d, verdict = %d, Fail count = %d"), err, verdict, i);
sl@0
   812
			INFO_PRINTF1(_L("Alloc testing completed successfully"));
sl@0
   813
			verdict = EPass;
sl@0
   814
			break;
sl@0
   815
			}
sl@0
   816
sl@0
   817
		__MM_HEAP_MARKEND;
sl@0
   818
		__UHEAP_RESET;
sl@0
   819
		}
sl@0
   820
	return verdict;	
sl@0
   821
	}
sl@0
   822
sl@0
   823
TVerdict RECamV2DirectVFNotificationTest::DoTestStep_53L()
sl@0
   824
	{
sl@0
   825
	TVerdict result = EPass;
sl@0
   826
	CCamera* camera = NULL;
sl@0
   827
	
sl@0
   828
	TInt error = KErrNone;
sl@0
   829
	CCamera::CCameraV2DirectViewFinder* directVF = NULL;
sl@0
   830
	
sl@0
   831
	// create client viewfinder object using New2L
sl@0
   832
	__MM_HEAP_MARK;
sl@0
   833
	INFO_PRINTF1(_L("Create camera using Camera::New2L() and MCameraObserver2"));
sl@0
   834
	
sl@0
   835
	TRAP(error, camera = CCamera::New2L(*this, 0, 0));
sl@0
   836
sl@0
   837
	if (error==KErrNone)
sl@0
   838
		{
sl@0
   839
		CleanupStack::PushL(camera);
sl@0
   840
		INFO_PRINTF1(_L("KErrNone return from CCamera::New2L()"));
sl@0
   841
		TRAP(error, directVF  = CCamera::CCameraV2DirectViewFinder::NewL(*camera, *this));	
sl@0
   842
		
sl@0
   843
		if (error==KErrNone)
sl@0
   844
	    	{
sl@0
   845
	    	CleanupStack::PushL(directVF);
sl@0
   846
	  		INFO_PRINTF1(_L("CCameraV2DirectViewFinder object was created using NewL")); 
sl@0
   847
	  		//Test Direct ViewFinder APIs
sl@0
   848
	  		INFO_PRINTF1(_L("Create Histogram for Direct ViewFinder"));
sl@0
   849
	  		CCamera::CCameraV2Histogram* histogram_DVF = directVF->CreateHistogramHandleL();
sl@0
   850
	  		if(!histogram_DVF)
sl@0
   851
	  			{
sl@0
   852
	  			INFO_PRINTF1(_L("Histogram creation for Direct ViewFinder unsuccessful"));
sl@0
   853
	  			result = EFail;
sl@0
   854
	  			}
sl@0
   855
	  			
sl@0
   856
	  		CleanupStack::PushL(histogram_DVF);
sl@0
   857
	  			
sl@0
   858
	  		INFO_PRINTF1(_L("Create ImageProcessing for Direct ViewFinder"));
sl@0
   859
	  		
sl@0
   860
	  		TRAPD(err, directVF->GetTransformationHandleL());
sl@0
   861
  			if(err != KErrNotSupported)
sl@0
   862
  				{
sl@0
   863
  				INFO_PRINTF1(_L("ImageProcessing creation for Direct ViewFinder: unexpected result!"));
sl@0
   864
  				result = EFail;
sl@0
   865
  				}
sl@0
   866
	  		
sl@0
   867
	  		//set properties for direct VF (base class)
sl@0
   868
	  		INFO_PRINTF1(_L("GetViewFinderFadingCapabilitiesL for Direct ViewFinder"));
sl@0
   869
	  		CCameraViewFinder::TViewFinderFadingCapabilities fadingCapabilities;
sl@0
   870
	  		TRAP(err,directVF->GetViewFinderFadingCapabilitiesL(fadingCapabilities));
sl@0
   871
  			if(err != KErrNotSupported)
sl@0
   872
  				{
sl@0
   873
  				INFO_PRINTF1(_L("GetViewFinderFadingCapabilitiesL for Direct ViewFinder: unexpected result!"));
sl@0
   874
  				result = EFail;
sl@0
   875
  				}
sl@0
   876
	  			
sl@0
   877
	  		INFO_PRINTF1(_L("GetViewFinderFadingEffectL for Direct ViewFinder"));
sl@0
   878
	  		CCameraViewFinder::TViewFinderFadingEffect fadingEffect;
sl@0
   879
	  		TRAP(err,directVF->GetViewFinderFadingEffectL(fadingEffect));
sl@0
   880
  			if(err != KErrNotSupported)
sl@0
   881
  				{
sl@0
   882
  				INFO_PRINTF1(_L("GetViewFinderFadingEffectL for Direct ViewFinder: unexpected result!"));
sl@0
   883
  				result = EFail;
sl@0
   884
  				}
sl@0
   885
	
sl@0
   886
			INFO_PRINTF1(_L("SetViewFinderFadingEffectL for Direct ViewFinder"));
sl@0
   887
			iInputEventUid = KUidECamEvent2ViewFinderFadingEffect;
sl@0
   888
			directVF->SetViewFinderFadingEffectL(fadingEffect);
sl@0
   889
			CheckNotificationNeg(iInputEventUid, result);
sl@0
   890
			
sl@0
   891
			TInt vfHandle=-1;
sl@0
   892
			directVF->GetViewFinderHandleL(vfHandle);
sl@0
   893
	  	
sl@0
   894
	  		//set properties for histogram (for viewfinder)
sl@0
   895
	  		TUint supportedHistogramType=0;
sl@0
   896
	  		histogram_DVF->GetSupportedHistogramsL(supportedHistogramType);
sl@0
   897
	  		if(supportedHistogramType!=0)
sl@0
   898
	  			{
sl@0
   899
	  			INFO_PRINTF1(_L("unexpected GetSupportedHistogramsL"));
sl@0
   900
	  			result = EFail;
sl@0
   901
	  			}
sl@0
   902
	  			
sl@0
   903
	  		INFO_PRINTF1(_L("GetDirectHistogramSupportInfoL for Histogram for Direct ViewFinder"));
sl@0
   904
	  		TBool directHistogramSupported = EFalse;
sl@0
   905
	  		TRAP(err,histogram_DVF->GetDirectHistogramSupportInfoL(directHistogramSupported));
sl@0
   906
  			if(err != KErrNotSupported)
sl@0
   907
  				{
sl@0
   908
  				INFO_PRINTF1(_L("GetDirectHistogramSupportInfoL for Histogram for Direct ViewFinder: unexpected result!"));
sl@0
   909
  				result = EFail;
sl@0
   910
  				}
sl@0
   911
	  			
sl@0
   912
	  		INFO_PRINTF1(_L("PrepareClientHistogramL for Histogram for Direct ViewFinder"));
sl@0
   913
	  		CCamera::CCameraV2Histogram::THistogramType histogramType = CCamera::CCameraV2Histogram::EHistNone;
sl@0
   914
	  		TRAP(err,histogram_DVF->PrepareClientHistogramL(histogramType));
sl@0
   915
  			if(err != KErrNotSupported)
sl@0
   916
  				{
sl@0
   917
  				INFO_PRINTF1(_L("PrepareClientHistogramL for Histogram for Direct ViewFinder: unexpected result!"));
sl@0
   918
  				result = EFail;
sl@0
   919
  				}
sl@0
   920
	  		
sl@0
   921
	  		INFO_PRINTF1(_L("PrepareDirectHistogramL for Histogram for Direct ViewFinder"));
sl@0
   922
	  		CCamera::CCameraV2Histogram::TDirectHistogramParameters histogramParameters;
sl@0
   923
	  		TRAP(err,histogram_DVF->PrepareDirectHistogramL(histogramParameters));
sl@0
   924
  			if(err != KErrNotSupported)
sl@0
   925
  				{
sl@0
   926
  				INFO_PRINTF1(_L("PrepareDirectHistogramL for Histogram for Direct ViewFinder: unexpected result!"));
sl@0
   927
  				result = EFail;
sl@0
   928
  				}
sl@0
   929
	  			
sl@0
   930
	  		INFO_PRINTF1(_L("UpdateDirectHistogramPropertiesL for Histogram for Direct ViewFinder"));
sl@0
   931
	   		TRAP(err,histogram_DVF->UpdateDirectHistogramPropertiesL(histogramParameters));
sl@0
   932
  			if(err != KErrNotSupported)
sl@0
   933
  				{
sl@0
   934
  				INFO_PRINTF1(_L("UpdateDirectHistogramPropertiesL for Histogram for Direct ViewFinder: unexpected result!"));
sl@0
   935
  				result = EFail;
sl@0
   936
  				}
sl@0
   937
	  			
sl@0
   938
	  		INFO_PRINTF1(_L("GetDirectHistogramPropertiesL for Histogram for Direct ViewFinder"));
sl@0
   939
	   		TRAP(err,histogram_DVF->GetDirectHistogramPropertiesL(histogramParameters));
sl@0
   940
  			if(err != KErrNotSupported)
sl@0
   941
  				{
sl@0
   942
  				INFO_PRINTF1(_L("GetDirectHistogramPropertiesL for Histogram for Direct ViewFinder: unexpected result!"));
sl@0
   943
  				result = EFail;
sl@0
   944
  				}
sl@0
   945
	  			
sl@0
   946
			INFO_PRINTF1(_L("GetHistogramStateL for Histogram for Direct ViewFinder"));
sl@0
   947
	   		TBool histogramActive = EFalse;
sl@0
   948
	   		TRAP(err,histogram_DVF->GetHistogramStateL(histogramActive));
sl@0
   949
  			if(err != KErrNotSupported)
sl@0
   950
  				{
sl@0
   951
  				INFO_PRINTF1(_L("GetHistogramStateL for Histogram for Direct ViewFinder: unexpected result!"));
sl@0
   952
  				result = EFail;
sl@0
   953
  				}
sl@0
   954
		
sl@0
   955
  			//viewfinder starting...
sl@0
   956
  			INFO_PRINTF1(_L("StartViewFinderDirectL for Direct ViewFinder"));
sl@0
   957
  			TSize size(320,240);
sl@0
   958
			TRect rect(TPoint(0,0),size);
sl@0
   959
			TRect cliprect(rect);
sl@0
   960
			RWsSession ws;
sl@0
   961
			CWsScreenDevice* screenDevice = NULL;
sl@0
   962
			RWindow window;
sl@0
   963
  			TRAP(err,directVF->StartViewFinderDirectL(ws, *screenDevice, window, rect));
sl@0
   964
  			if(err != KErrNone)
sl@0
   965
  				{
sl@0
   966
  				INFO_PRINTF1(_L("StartViewFinderDirectL for Direct ViewFinder: unexpected result!"));
sl@0
   967
  				result = EFail;
sl@0
   968
  				}
sl@0
   969
			CheckViewFinderNegNotification(vfHandle, result);
sl@0
   970
			
sl@0
   971
			TRAP(err,directVF->StartViewFinderDirectL(ws, *screenDevice, window, rect, cliprect));
sl@0
   972
  			if(err != KErrNone)
sl@0
   973
  				{
sl@0
   974
  				INFO_PRINTF1(_L("StartViewFinderDirectL (with cliprect) for Direct ViewFinder: unexpected result!"));
sl@0
   975
  				result = EFail;
sl@0
   976
  				}
sl@0
   977
			CheckViewFinderNegNotification(vfHandle, result);
sl@0
   978
			
sl@0
   979
			INFO_PRINTF1(_L("GetDirectViewFinderPropertiesL for Direct ViewFinder"));
sl@0
   980
			TInt screenNumber=0;
sl@0
   981
			TRAP(err,directVF->GetDirectViewFinderPropertiesL(screenNumber, rect, cliprect));
sl@0
   982
			if(err != KErrNotSupported)
sl@0
   983
  				{
sl@0
   984
  				INFO_PRINTF1(_L("GetDirectViewFinderPropertiesL for Direct ViewFinder: unexpected result!"));
sl@0
   985
  				result = EFail;
sl@0
   986
  				}
sl@0
   987
  				
sl@0
   988
  			INFO_PRINTF1(_L("PauseViewFinderDirect for Direct ViewFinder"));
sl@0
   989
			directVF->PauseViewFinderDirect();
sl@0
   990
			
sl@0
   991
			INFO_PRINTF1(_L("ResumeViewFinderDirect for Direct ViewFinder"));
sl@0
   992
			directVF->ResumeViewFinderDirect();
sl@0
   993
			CheckViewFinderNegNotification(vfHandle, result);
sl@0
   994
			
sl@0
   995
			INFO_PRINTF1(_L("StartHistogram for Direct ViewFinder"));
sl@0
   996
			histogram_DVF->StartHistogram();
sl@0
   997
			CheckViewFinderNegNotification(vfHandle, result);
sl@0
   998
	  		
sl@0
   999
	  		INFO_PRINTF1(_L("StopHistogram for Direct ViewFinder"));	
sl@0
  1000
			histogram_DVF->StopHistogram();
sl@0
  1001
			
sl@0
  1002
			INFO_PRINTF1(_L("GetViewFinderStateL for Direct ViewFinder"));
sl@0
  1003
			CCamera::CCameraV2DirectViewFinder::TViewFinderState vfState = CCamera::CCameraV2DirectViewFinder::EViewFinderInActive;
sl@0
  1004
			TRAP(err,directVF->GetViewFinderStateL(vfState));
sl@0
  1005
			if(err != KErrNotSupported)
sl@0
  1006
  				{
sl@0
  1007
  				INFO_PRINTF1(_L("GetViewFinderStateL for Direct ViewFinder: unexpected result!"));
sl@0
  1008
  				result = EFail;
sl@0
  1009
  				}
sl@0
  1010
  				
sl@0
  1011
  			//access direct snapshot functionality
sl@0
  1012
  			INFO_PRINTF1(_L("Access direct snapshot functionality"));
sl@0
  1013
  			CCamera::CCameraDirectSnapshot* directSnapshot = directVF->GetDirectSnapshotHandleL();
sl@0
  1014
  			if(directSnapshot == NULL)
sl@0
  1015
	  			{
sl@0
  1016
	  			INFO_PRINTF1(_L("Direct Snapshot creation for Direct ViewFinder unsuccessful"));
sl@0
  1017
	  			result = EFail;
sl@0
  1018
	  			}
sl@0
  1019
	  			
sl@0
  1020
	  		CleanupStack::PushL(directSnapshot);
sl@0
  1021
	  		
sl@0
  1022
	  		INFO_PRINTF1(_L("Get parent viewfinder for direct snapshot"));
sl@0
  1023
	  		CCamera::CCameraV2DirectViewFinder* directViewFinder = NULL;
sl@0
  1024
	  		TRAP(err, directSnapshot->GetDirectViewFinderL(directViewFinder));
sl@0
  1025
  			if(err != KErrNone)
sl@0
  1026
  				{
sl@0
  1027
  				INFO_PRINTF1(_L("GetDirectViewFinderL for Direct ViewFinder Snapshot: unexpected result!"));
sl@0
  1028
  				result = EFail;
sl@0
  1029
  				}
sl@0
  1030
  			
sl@0
  1031
  			TInt viewfinderHandle = -1;
sl@0
  1032
  			directViewFinder->GetViewFinderHandleL(viewfinderHandle);
sl@0
  1033
  			if(vfHandle != viewfinderHandle)
sl@0
  1034
  				{
sl@0
  1035
  				INFO_PRINTF1(_L("Parent Viewfinder for Direct ViewFinder Snapshot: unexpected result!"));
sl@0
  1036
  				result = EFail;
sl@0
  1037
  				}
sl@0
  1038
  			
sl@0
  1039
  			CCamera::CCameraDirectSnapshot::TDirectSnapshotParameters directSnapshotParameters;
sl@0
  1040
  			
sl@0
  1041
  			if(directSnapshotParameters.Size() != sizeof(CCamera::CCameraDirectSnapshot::TDirectSnapshotParameters) ||
sl@0
  1042
  				directSnapshotParameters.Version() != KECamDirectSnapshotParametersCurrentVersion)
sl@0
  1043
  				{
sl@0
  1044
  				INFO_PRINTF1(_L("TDirectSnapshotParameters has different version for Direct Snapshot: unexpected result!"));
sl@0
  1045
  				result = EFail;
sl@0
  1046
  				}
sl@0
  1047
  			
sl@0
  1048
   			INFO_PRINTF1(_L("SetAspectRatioState for Direct Snapshot"));
sl@0
  1049
			directSnapshotParameters.SetAspectRatioState(ETrue);
sl@0
  1050
			TBool aspectRatioState = directSnapshotParameters.IsAspectRatioMaintained();
sl@0
  1051
			if(!aspectRatioState)
sl@0
  1052
				{
sl@0
  1053
				INFO_PRINTF1(_L("AspectRatioState for Direct Snapshot: unexpected result!"));
sl@0
  1054
  				result = EFail;
sl@0
  1055
				}
sl@0
  1056
				
sl@0
  1057
			directSnapshotParameters.SetAspectRatioState(EFalse);
sl@0
  1058
			aspectRatioState = directSnapshotParameters.IsAspectRatioMaintained();
sl@0
  1059
			if(aspectRatioState != EFalse)
sl@0
  1060
				{
sl@0
  1061
				INFO_PRINTF1(_L("AspectRatioState for Direct Snapshot: unexpected result!"));
sl@0
  1062
  				result = EFail;
sl@0
  1063
				}
sl@0
  1064
			
sl@0
  1065
			INFO_PRINTF1(_L("EnableDirectSnapshotL for Direct Snapshot"));	
sl@0
  1066
  			TRAP(err, directSnapshot->EnableDirectSnapshotL(directSnapshotParameters));
sl@0
  1067
  			if(err != KErrNone)
sl@0
  1068
  				{
sl@0
  1069
  				INFO_PRINTF1(_L("EnableDirectSnapshotL for DirectSnapshot: unexpected result!"));
sl@0
  1070
  				result = EFail;
sl@0
  1071
  				}
sl@0
  1072
  			
sl@0
  1073
  			INFO_PRINTF1(_L("GetDirectSnapshotStateL for Direct Snapshot"));
sl@0
  1074
  			CCamera::CCameraDirectSnapshot::TDirectSnapshotState directSnapshotState;	
sl@0
  1075
  			TRAP(err, directSnapshot->GetDirectSnapshotStateL(directSnapshotState));
sl@0
  1076
  			if(err != KErrNone)
sl@0
  1077
  				{
sl@0
  1078
  				INFO_PRINTF1(_L("GetDirectSnapshotStateL for DirectSnapshot: unexpected result!"));
sl@0
  1079
  				result = EFail;
sl@0
  1080
  				}
sl@0
  1081
  				
sl@0
  1082
  			if(CCamera::CCameraDirectSnapshot::EDirectSnapshotEnabled != directSnapshotState)
sl@0
  1083
  				{
sl@0
  1084
  				INFO_PRINTF1(_L("DirectSnapshotState not set properly: unexpected result!"));
sl@0
  1085
  				result = EFail;
sl@0
  1086
  				}
sl@0
  1087
  			
sl@0
  1088
  			INFO_PRINTF1(_L("GetDirectSnapshotParametersL for Direct Snapshot"));
sl@0
  1089
  			CCamera::CCameraDirectSnapshot::TDirectSnapshotParameters directSnapshotParam;	
sl@0
  1090
  			TRAP(err, directSnapshot->GetDirectSnapshotParametersL(directSnapshotParam));
sl@0
  1091
  			if(err != KErrNone)
sl@0
  1092
  				{
sl@0
  1093
  				INFO_PRINTF1(_L("GetDirectSnapshotParametersL for DirectSnapshot: unexpected result!"));
sl@0
  1094
  				result = EFail;
sl@0
  1095
  				}
sl@0
  1096
  				
sl@0
  1097
  			if(directSnapshotParam.IsAspectRatioMaintained() != directSnapshotParameters.IsAspectRatioMaintained())
sl@0
  1098
  				{
sl@0
  1099
  				INFO_PRINTF1(_L("DirectSnapshotParameters for DirectSnapshot wrongly set: unexpected result!"));
sl@0
  1100
  				result = EFail;
sl@0
  1101
  				}
sl@0
  1102
  			
sl@0
  1103
  			INFO_PRINTF1(_L("SetDirectSnapshotParametersL for Direct Snapshot"));
sl@0
  1104
  			directSnapshotParameters.SetAspectRatioState(ETrue);	
sl@0
  1105
  			TRAP(err, directSnapshot->SetDirectSnapshotParametersL(directSnapshotParameters));
sl@0
  1106
			if(err != KErrNone)
sl@0
  1107
				{
sl@0
  1108
				INFO_PRINTF1(_L("SetDirectSnapshotParametersL for DirectSnapshot: unexpected result!"));
sl@0
  1109
  				result = EFail;	
sl@0
  1110
				}
sl@0
  1111
			
sl@0
  1112
			INFO_PRINTF1(_L("DisableDirectSnapshot for Direct Snapshot"));
sl@0
  1113
			directSnapshot->DisableDirectSnapshot();
sl@0
  1114
			TRAP(err, directSnapshot->GetDirectSnapshotStateL(directSnapshotState));
sl@0
  1115
  			if(err != KErrNone)
sl@0
  1116
  				{
sl@0
  1117
  				INFO_PRINTF1(_L("GetDirectSnapshotStateL for DirectSnapshot: unexpected result!"));
sl@0
  1118
  				result = EFail;
sl@0
  1119
  				}
sl@0
  1120
  			
sl@0
  1121
  			if(CCamera::CCameraDirectSnapshot::EDirectSnapshotDisabled != directSnapshotState)
sl@0
  1122
  				{
sl@0
  1123
  				INFO_PRINTF1(_L("GetDirectSnapshotStateL for DirectSnapshot: unexpected result!"));
sl@0
  1124
  				result = EFail;
sl@0
  1125
  				}
sl@0
  1126
							
sl@0
  1127
			INFO_PRINTF1(_L("StopDirectViewFinder for Direct ViewFinder"));
sl@0
  1128
			directVF->StopDirectViewFinder();
sl@0
  1129
			
sl@0
  1130
			CleanupStack::PopAndDestroy(directSnapshot);
sl@0
  1131
			CleanupStack::PopAndDestroy(histogram_DVF);
sl@0
  1132
	    	CleanupStack::PopAndDestroy(directVF);
sl@0
  1133
	    	}
sl@0
  1134
	    else
sl@0
  1135
    		{
sl@0
  1136
    		INFO_PRINTF1(_L("CCameraV2DirectViewFinder object not created")); 
sl@0
  1137
    		result = EFail;
sl@0
  1138
    		}	
sl@0
  1139
		CleanupStack::PopAndDestroy(camera);
sl@0
  1140
		}
sl@0
  1141
	else 
sl@0
  1142
		{
sl@0
  1143
		INFO_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
sl@0
  1144
		result = EFail;		
sl@0
  1145
		}
sl@0
  1146
	__MM_HEAP_MARKEND;
sl@0
  1147
   
sl@0
  1148
	return result;	
sl@0
  1149
	}
sl@0
  1150
/*------------------------------------------------------------------
sl@0
  1151
 	Pre Image Capture Control : RECamPreImgCaptureNotificationTest
sl@0
  1152
 *-----------------------------------------------------------------*/
sl@0
  1153
RECamPreImgCaptureNotificationTest* RECamPreImgCaptureNotificationTest::NewL(TBool aAllocTest)
sl@0
  1154
	{
sl@0
  1155
	return new (ELeave)RECamPreImgCaptureNotificationTest(aAllocTest);
sl@0
  1156
	}
sl@0
  1157
	
sl@0
  1158
RECamPreImgCaptureNotificationTest::RECamPreImgCaptureNotificationTest(TBool /*aAllocTest*/)
sl@0
  1159
	{
sl@0
  1160
	iTestStepName = _L("MM-ECM-ADV-U-054-HP");
sl@0
  1161
	iCaptureImageHandle = NULL;
sl@0
  1162
	}
sl@0
  1163
	
sl@0
  1164
void RECamPreImgCaptureNotificationTest::PrepareImageComplete(CCamera::CCameraImageCapture* aCaptureImageHandle, TInt aErrorCode)
sl@0
  1165
	{
sl@0
  1166
	iCaptureImageHandle = aCaptureImageHandle;
sl@0
  1167
	iError = aErrorCode;
sl@0
  1168
	}
sl@0
  1169
sl@0
  1170
TInt RECamPreImgCaptureNotificationTest::CustomInterface(TUid /*aInterface*/, TAny*& /*aPtrInterface*/)
sl@0
  1171
	{
sl@0
  1172
	return KErrNone;
sl@0
  1173
	}
sl@0
  1174
sl@0
  1175
void RECamPreImgCaptureNotificationTest::CheckCaptureNotification(CCamera::CCameraImageCapture*& aImageCapture, TVerdict& aResult)
sl@0
  1176
	{
sl@0
  1177
	INFO_PRINTF2(_L("Pre Image Capture Control Error %d, "), iError); 
sl@0
  1178
	if (iError != KErrNone)
sl@0
  1179
		{
sl@0
  1180
	    aResult = EFail;
sl@0
  1181
	    }
sl@0
  1182
	else
sl@0
  1183
		{
sl@0
  1184
		aImageCapture = iCaptureImageHandle;
sl@0
  1185
		}
sl@0
  1186
	}
sl@0
  1187
	
sl@0
  1188
TVerdict RECamPreImgCaptureNotificationTest::DoTestStepL()
sl@0
  1189
	{
sl@0
  1190
	TVerdict verdict = EFail;
sl@0
  1191
	INFO_PRINTF1(_L("Alloc test"));
sl@0
  1192
	
sl@0
  1193
	TInt i, err;
sl@0
  1194
	
sl@0
  1195
	for (i =1; ;i++)
sl@0
  1196
		{
sl@0
  1197
		if (i % 5 == 0)
sl@0
  1198
			{
sl@0
  1199
			INFO_PRINTF2(_L("Fail count = %d"), i);
sl@0
  1200
			}
sl@0
  1201
sl@0
  1202
		__UHEAP_SETFAIL(RHeap::EFailNext,i);
sl@0
  1203
		__MM_HEAP_MARK;
sl@0
  1204
sl@0
  1205
		TRAP(err,verdict = DoPreImgCaptureTestStepL());
sl@0
  1206
sl@0
  1207
		TAny* testAlloc = User::Alloc(1);
sl@0
  1208
		TBool heapTestingComplete = ((testAlloc == NULL ) && (err == KErrNone));
sl@0
  1209
		User::Free(testAlloc);
sl@0
  1210
sl@0
  1211
		if ((err != KErrNoMemory && verdict == EPass) || heapTestingComplete)
sl@0
  1212
			{
sl@0
  1213
			INFO_PRINTF4(_L("err = %d, verdict = %d, Fail count = %d"), err, verdict, i);
sl@0
  1214
			INFO_PRINTF1(_L("Alloc testing completed successfully"));
sl@0
  1215
			verdict = EPass;
sl@0
  1216
			break;
sl@0
  1217
			}
sl@0
  1218
sl@0
  1219
		__MM_HEAP_MARKEND;
sl@0
  1220
		__UHEAP_RESET;
sl@0
  1221
		}
sl@0
  1222
	return verdict;
sl@0
  1223
	}
sl@0
  1224
sl@0
  1225
TVerdict RECamPreImgCaptureNotificationTest::DoPreImgCaptureTestStepL()
sl@0
  1226
	{
sl@0
  1227
	TVerdict result = EPass;
sl@0
  1228
	CCamera* camera = NULL;
sl@0
  1229
	
sl@0
  1230
	TInt error = KErrNone;
sl@0
  1231
	CCamera::CCameraPreImageCaptureControl* preImgCapture = NULL;
sl@0
  1232
	
sl@0
  1233
	// using observer 	
sl@0
  1234
	__MM_HEAP_MARK;
sl@0
  1235
	MCameraObserver* observer=NULL;
sl@0
  1236
	INFO_PRINTF1(_L("Create camera using Camera::NewL() and MCameraObserver"));
sl@0
  1237
	TRAP(error, camera = CCamera::NewL(*observer, 0));
sl@0
  1238
	if (error==KErrNone)
sl@0
  1239
		{
sl@0
  1240
		CleanupStack::PushL(camera);
sl@0
  1241
		INFO_PRINTF1(_L("Create PreImageCaptureControl from CCamera object"));
sl@0
  1242
		
sl@0
  1243
		TRAP(error, preImgCapture  = CCamera::CCameraPreImageCaptureControl::NewL(*camera, *this));	
sl@0
  1244
 		if (error==KErrExtensionNotSupported)
sl@0
  1245
	    	{
sl@0
  1246
	    	INFO_PRINTF1(_L("CCameraPreImageCaptureControl object creation using old Observer failed with correct error"));
sl@0
  1247
	    	}
sl@0
  1248
	    else
sl@0
  1249
    		{
sl@0
  1250
    		INFO_PRINTF1(_L("CCameraPreImageCaptureControl object creation using old Observer gave unexpected result"));
sl@0
  1251
    		result = EFail;
sl@0
  1252
    		}	
sl@0
  1253
		CleanupStack::PopAndDestroy(camera);
sl@0
  1254
		}
sl@0
  1255
	else 
sl@0
  1256
		{
sl@0
  1257
		INFO_PRINTF2(_L("Unexpected %d return from CCamera::NewL()"), error);
sl@0
  1258
		result = EFail;	
sl@0
  1259
		User::Leave(KErrNoMemory);	
sl@0
  1260
		}
sl@0
  1261
	__MM_HEAP_MARKEND;
sl@0
  1262
	
sl@0
  1263
	// using observer2 with NewL 
sl@0
  1264
	__MM_HEAP_MARK;
sl@0
  1265
	INFO_PRINTF1(_L("Create camera using Camera::NewL() and MCameraObserver2"));
sl@0
  1266
	TRAP(error, camera = CCamera::NewL(*this, 0,0));
sl@0
  1267
	if (error==KErrNone)
sl@0
  1268
		{
sl@0
  1269
		CleanupStack::PushL(camera);
sl@0
  1270
		INFO_PRINTF1(_L("Create PreImageCaptureControl from CCamera object"));
sl@0
  1271
		
sl@0
  1272
		TRAP(error, preImgCapture  = CCamera::CCameraPreImageCaptureControl::NewL(*camera, *this));		
sl@0
  1273
 		if (error==KErrExtensionNotSupported)
sl@0
  1274
	    	{
sl@0
  1275
	    	INFO_PRINTF1(_L("CCameraPreImageCaptureControl object creation using Observer2 with NewL failed with correct error"));
sl@0
  1276
	    	}
sl@0
  1277
	    else
sl@0
  1278
    		{
sl@0
  1279
    		INFO_PRINTF1(_L("CCameraPreImageCaptureControl object creation using Observer2 with NewL gave unexpected result"));
sl@0
  1280
    		result = EFail;
sl@0
  1281
    		}	
sl@0
  1282
		CleanupStack::PopAndDestroy(camera);
sl@0
  1283
		}
sl@0
  1284
	else 
sl@0
  1285
		{
sl@0
  1286
		INFO_PRINTF2(_L("Unexpected %d return from CCamera::NewL()"), error);
sl@0
  1287
		result = EFail;	
sl@0
  1288
		User::Leave(KErrNoMemory);	
sl@0
  1289
		}
sl@0
  1290
	__MM_HEAP_MARKEND;
sl@0
  1291
	
sl@0
  1292
	// create pre image control object using New2L
sl@0
  1293
	__MM_HEAP_MARK;
sl@0
  1294
	INFO_PRINTF1(_L("Create camera using Camera::New2L() and MCameraObserver2"));
sl@0
  1295
	
sl@0
  1296
	TRAP(error, camera = CCamera::New2L(*this, 0,0));
sl@0
  1297
	if (error==KErrNone)
sl@0
  1298
		{
sl@0
  1299
		CleanupStack::PushL(camera);
sl@0
  1300
		INFO_PRINTF1(_L("KErrNone return from CCamera::New2L()"));
sl@0
  1301
		TRAP(error, preImgCapture = CCamera::CCameraPreImageCaptureControl::NewL(*camera, *this));	
sl@0
  1302
		
sl@0
  1303
		if (error==KErrNone)
sl@0
  1304
	    	{
sl@0
  1305
	    	CleanupStack::PushL(preImgCapture);
sl@0
  1306
	  		INFO_PRINTF1(_L("CCameraPreImageCaptureControl object was created using NewL")); 
sl@0
  1307
	  		
sl@0
  1308
	  		INFO_PRINTF1(_L("GetDirectSnapshotSupportInfoL for PreImageCaptureControl"));
sl@0
  1309
	  		TUint directSnapshotSupportInfo = 0;
sl@0
  1310
	  		TRAPD(err, preImgCapture->GetDirectSnapshotSupportInfoL(directSnapshotSupportInfo));
sl@0
  1311
	  		if(err != KErrNone)
sl@0
  1312
  				{
sl@0
  1313
  				INFO_PRINTF1(_L("GetDirectSnapshotSupportInfoL for PreImageCaptureControl : unexpected result!"));
sl@0
  1314
  				result = EFail;
sl@0
  1315
  				}
sl@0
  1316
	    	
sl@0
  1317
	    	INFO_PRINTF1(_L("GetSupportedEmbeddedStillCaptureSettingsL for PreImageCaptureControl"));
sl@0
  1318
	  		RArray<TUid> supportedEmbeddedStillCaptureSettings;
sl@0
  1319
	  		TRAP(err, preImgCapture->GetSupportedEmbeddedStillCaptureSettingsL(supportedEmbeddedStillCaptureSettings));
sl@0
  1320
  			if(err != KErrNone)
sl@0
  1321
  				{
sl@0
  1322
  				INFO_PRINTF1(_L("GetSupportedEmbeddedStillCaptureSettingsL for PreImageCaptureControl : unexpected result!"));
sl@0
  1323
  				result = EFail;
sl@0
  1324
  				}
sl@0
  1325
  			
sl@0
  1326
  			if(supportedEmbeddedStillCaptureSettings.Count() != 0)
sl@0
  1327
  				{
sl@0
  1328
  				INFO_PRINTF1(_L("Number of SupportedEmbeddedStillCaptureSettings for PreImageCaptureControl : unexpected result!"));
sl@0
  1329
  				result = EFail;
sl@0
  1330
  				}
sl@0
  1331
	    	
sl@0
  1332
	    	INFO_PRINTF1(_L("GetSupportedDirectSavingTypeL for PreImageCaptureControl"));
sl@0
  1333
	  		CCamera::CCameraPreImageCaptureControl::TDirectSavingType supportedDirectSavingType 
sl@0
  1334
	  				= CCamera::CCameraPreImageCaptureControl::EDirectSavingNotUsed;
sl@0
  1335
	  		TRAP(err, preImgCapture->GetSupportedDirectSavingTypeL(supportedDirectSavingType));
sl@0
  1336
  			if(err != KErrNone)
sl@0
  1337
  				{
sl@0
  1338
  				INFO_PRINTF1(_L("GetSupportedDirectSavingTypeL for PreImageCaptureControl : unexpected result!"));
sl@0
  1339
  				result = EFail;
sl@0
  1340
  				}
sl@0
  1341
  				
sl@0
  1342
			INFO_PRINTF1(_L("SetSequentialImageFilenameL for PreImageCaptureControl"));
sl@0
  1343
	  		_LIT8(KDirectSavingFileName, "C:\\ECam.jpg");
sl@0
  1344
	  		TInt seqNum = 0;
sl@0
  1345
	  		TRAP(err, preImgCapture->SetSequentialImageFilenameL(KDirectSavingFileName, seqNum));
sl@0
  1346
  			if(err != KErrNotSupported)
sl@0
  1347
  				{
sl@0
  1348
  				INFO_PRINTF1(_L("SetSequentialImageFilenameL for PreImageCaptureControl : unexpected result!"));
sl@0
  1349
  				result = EFail;
sl@0
  1350
  				}
sl@0
  1351
			
sl@0
  1352
			INFO_PRINTF1(_L("SetLowerResolutionSequentialImageFilenameL for PreImageCaptureControl"));
sl@0
  1353
	  		_LIT8(KLowResDirectSavingFileName, "C:\\ECamLowRes.jpg");
sl@0
  1354
	  		TRAP(err, preImgCapture->SetLowerResolutionSequentialImageFilenameL(KLowResDirectSavingFileName, seqNum));
sl@0
  1355
  			if(err != KErrNotSupported)
sl@0
  1356
  				{
sl@0
  1357
  				INFO_PRINTF1(_L("SetLowerResolutionSequentialImageFilenameL for PreImageCaptureControl : unexpected result!"));
sl@0
  1358
  				result = EFail;
sl@0
  1359
  				}
sl@0
  1360
  				
sl@0
  1361
  			INFO_PRINTF1(_L("GetDirectSavingTypeL for PreImageCaptureControl"));
sl@0
  1362
	  		CCamera::CCameraPreImageCaptureControl::TDirectSavingType directSavingType 
sl@0
  1363
	  				= CCamera::CCameraPreImageCaptureControl::EDirectSavingNotUsed;
sl@0
  1364
	  		TRAP(err, preImgCapture->GetDirectSavingTypeL(directSavingType));
sl@0
  1365
  			if(err != KErrNone)
sl@0
  1366
  				{
sl@0
  1367
  				INFO_PRINTF1(_L("GetDirectSavingTypeL for PreImageCaptureControl : unexpected result!"));
sl@0
  1368
  				result = EFail;
sl@0
  1369
  				}
sl@0
  1370
  				
sl@0
  1371
  			INFO_PRINTF1(_L("SetDirectSavingTypeL for PreImageCaptureControl"));
sl@0
  1372
  			TRAP(err, preImgCapture->SetDirectSavingTypeL(CCamera::CCameraPreImageCaptureControl::EDirectSavingHighResolutionFileOnly));
sl@0
  1373
  			if(err != KErrNotSupported)
sl@0
  1374
  				{
sl@0
  1375
  				INFO_PRINTF1(_L("SetDirectSavingTypeL for PreImageCaptureControl : unexpected result!"));
sl@0
  1376
  				result = EFail;
sl@0
  1377
  				}
sl@0
  1378
  				
sl@0
  1379
  			INFO_PRINTF1(_L("GetCaptureEventSupportInfoL for PreImageCaptureControl"));
sl@0
  1380
  			TUint supportedDriveModes = 0;
sl@0
  1381
  			TRAP(err, preImgCapture->GetCaptureEventSupportInfoL(supportedDriveModes));
sl@0
  1382
  			if(err != KErrNone)
sl@0
  1383
  				{
sl@0
  1384
  				INFO_PRINTF1(_L("GetCaptureEventSupportInfoL for PreImageCaptureControl : unexpected result!"));
sl@0
  1385
  				result = EFail;
sl@0
  1386
  				}
sl@0
  1387
  				
sl@0
  1388
  			INFO_PRINTF1(_L("GetImageFormatsSupportedL for PreImageCaptureControl"));
sl@0
  1389
  			TSize size(640,480);
sl@0
  1390
  			TUint imageFormatsSupported = 0;
sl@0
  1391
  			TRAP(err, preImgCapture->GetImageFormatsSupportedL(imageFormatsSupported, size));
sl@0
  1392
  			if(err != KErrNone)
sl@0
  1393
  				{
sl@0
  1394
  				INFO_PRINTF1(_L("GetImageFormatsSupportedL for PreImageCaptureControl : unexpected result!"));
sl@0
  1395
  				result = EFail;
sl@0
  1396
  				}
sl@0
  1397
  				
sl@0
  1398
  			INFO_PRINTF1(_L("GetPixelAspectsSupportedL for PreImageCaptureControl"));
sl@0
  1399
    			TUint pixelAspectsSupported = 0;
sl@0
  1400
  			TRAP(err, preImgCapture->GetPixelAspectsSupportedL(pixelAspectsSupported, CCamera::EFormatFbsBitmapColor16M, size));
sl@0
  1401
  			if(err != KErrNone)
sl@0
  1402
  				{
sl@0
  1403
  				INFO_PRINTF1(_L("GetPixelAspectsSupportedL for PreImageCaptureControl : unexpected result!"));
sl@0
  1404
  				result = EFail;
sl@0
  1405
  				}
sl@0
  1406
			
sl@0
  1407
			INFO_PRINTF1(_L("GetImageMaxMemorySizeSettingSupportInfoL for PreImageCaptureControl"));
sl@0
  1408
  			TBool maxMemorySizeSettingSupported = EFalse;
sl@0
  1409
  			TRAP(err, preImgCapture->GetImageMaxMemorySizeSettingSupportInfoL(maxMemorySizeSettingSupported));
sl@0
  1410
  			if(err != KErrNone)
sl@0
  1411
  				{
sl@0
  1412
  				INFO_PRINTF1(_L("GetImageMaxMemorySizeSettingSupportInfoL for PreImageCaptureControl : unexpected result!"));
sl@0
  1413
  				result = EFail;
sl@0
  1414
  				}
sl@0
  1415
  			
sl@0
  1416
  			INFO_PRINTF1(_L("GetImageMaxMemorySizeL for PreImageCaptureControl"));
sl@0
  1417
  			TUint memorySize = 0;
sl@0
  1418
  			TRAP(err, preImgCapture->GetImageMaxMemorySizeL(memorySize));
sl@0
  1419
  			if(err != KErrNotSupported)
sl@0
  1420
  				{
sl@0
  1421
  				INFO_PRINTF1(_L("GetImageMaxMemorySizeL for PreImageCaptureControl : unexpected result!"));
sl@0
  1422
  				result = EFail;
sl@0
  1423
  				}	
sl@0
  1424
			
sl@0
  1425
			INFO_PRINTF1(_L("GetSupportedProcessingOptionsL for PreImageCaptureControl"));
sl@0
  1426
			TUint processingOptions = 0;
sl@0
  1427
			TRAP(err, preImgCapture->GetSupportedProcessingOptionsL(processingOptions));
sl@0
  1428
			if(err != KErrNotSupported)
sl@0
  1429
				{
sl@0
  1430
				INFO_PRINTF1(_L("GetSupportedProcessingOptionsL for PreImageCaptureControl : unexpected result!"));
sl@0
  1431
				}
sl@0
  1432
			
sl@0
  1433
  			INFO_PRINTF1(_L("PrepareImageCapture for PreImageCaptureControl"));
sl@0
  1434
  			CCamera::CCameraPreImageCaptureControl::TPrepareImageParameters prepareImageParameters;
sl@0
  1435
 
sl@0
  1436
  			INFO_PRINTF1(_L("Setting processing options member variable"));
sl@0
  1437
  			TUint options = 0;
sl@0
  1438
  			options |= CCamera::CCameraPreImageCaptureControl::EEcamNormalProcessing;
sl@0
  1439
  			prepareImageParameters.SetImageProcessingOptions(options);
sl@0
  1440
  			INFO_PRINTF1(_L("Getting processing options member variable"));
sl@0
  1441
  			TUint retrievedOptions = 0;
sl@0
  1442
  			prepareImageParameters.GetImageProcessingOptions(retrievedOptions);
sl@0
  1443
  			if(retrievedOptions != options)
sl@0
  1444
  				{
sl@0
  1445
  				INFO_PRINTF1(_L("Set image processing option does not match retrieved image processing option"));
sl@0
  1446
  				result = EFail;
sl@0
  1447
  				}
sl@0
  1448
  			else
sl@0
  1449
  				{
sl@0
  1450
  				INFO_PRINTF1(_L("Set image processing option matches retrieved image processing option"));
sl@0
  1451
  				}
sl@0
  1452
 
sl@0
  1453
  			MCaptureImageObserver* 	captureImageObserver = NULL;
sl@0
  1454
  			preImgCapture->PrepareImageCapture(prepareImageParameters, *captureImageObserver);
sl@0
  1455
  			CCamera::CCameraImageCapture* imageCapture = NULL;
sl@0
  1456
			CheckCaptureNotification(imageCapture, result);	
sl@0
  1457
			
sl@0
  1458
			if(imageCapture == NULL)
sl@0
  1459
				{
sl@0
  1460
				INFO_PRINTF1(_L("CCameraImageCapture object not created!"));
sl@0
  1461
  				result = EFail;
sl@0
  1462
				}
sl@0
  1463
			else
sl@0
  1464
			    {
sl@0
  1465
				delete imageCapture;
sl@0
  1466
				}
sl@0
  1467
	    
sl@0
  1468
	    	CleanupStack::PopAndDestroy(preImgCapture);
sl@0
  1469
	    	}
sl@0
  1470
	    else
sl@0
  1471
    		{
sl@0
  1472
    		INFO_PRINTF1(_L("CCameraPreImageCaptureControl object was not created using NewL")); 
sl@0
  1473
    		result = EFail;
sl@0
  1474
    		}	
sl@0
  1475
		CleanupStack::PopAndDestroy(camera);
sl@0
  1476
		}
sl@0
  1477
	else 
sl@0
  1478
		{
sl@0
  1479
		INFO_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
sl@0
  1480
		result = EFail;		
sl@0
  1481
		}
sl@0
  1482
	__MM_HEAP_MARKEND;
sl@0
  1483
   
sl@0
  1484
	return result;
sl@0
  1485
	}
sl@0
  1486
/*------------------------------------------------------------------
sl@0
  1487
 	Image Capture Control : RECamImgCaptureNotificationTest
sl@0
  1488
 *-----------------------------------------------------------------*/
sl@0
  1489
RECamImgCaptureNotificationTest* RECamImgCaptureNotificationTest::NewL(TBool aAllocTest)
sl@0
  1490
	{
sl@0
  1491
	return new (ELeave)RECamImgCaptureNotificationTest(aAllocTest);
sl@0
  1492
	}
sl@0
  1493
	
sl@0
  1494
RECamImgCaptureNotificationTest::RECamImgCaptureNotificationTest(TBool /*aAllocTest*/)
sl@0
  1495
	{
sl@0
  1496
	iTestStepName = _L("MM-ECM-ADV-U-055-HP");
sl@0
  1497
	iCaptureImageHandle = NULL;
sl@0
  1498
	}
sl@0
  1499
	
sl@0
  1500
void RECamImgCaptureNotificationTest::PrepareImageComplete(CCamera::CCameraImageCapture* aCaptureImageHandle, TInt aErrorCode)
sl@0
  1501
	{
sl@0
  1502
	iCaptureImageHandle = aCaptureImageHandle;
sl@0
  1503
	iError = aErrorCode;
sl@0
  1504
	}
sl@0
  1505
sl@0
  1506
TInt RECamImgCaptureNotificationTest::CustomInterface(TUid /*aInterface*/, TAny*& /*aPtrInterface*/)
sl@0
  1507
	{
sl@0
  1508
	return KErrNone;
sl@0
  1509
	}
sl@0
  1510
sl@0
  1511
void RECamImgCaptureNotificationTest::CheckPreCaptureNotification(CCamera::CCameraImageCapture*& aImageCapture, TVerdict& aResult)
sl@0
  1512
	{
sl@0
  1513
	INFO_PRINTF2(_L("Pre Image Capture Control Error %d, "), iError); 
sl@0
  1514
	if (iError != KErrNone)
sl@0
  1515
		{
sl@0
  1516
	    aResult = EFail;
sl@0
  1517
	    }
sl@0
  1518
	else
sl@0
  1519
		{
sl@0
  1520
		aImageCapture = iCaptureImageHandle;
sl@0
  1521
		}
sl@0
  1522
	}
sl@0
  1523
	
sl@0
  1524
void RECamImgCaptureNotificationTest::IndividualImageControlHandle(CCamera::CCameraImageCapture& aCaptureImageHandle, TPostCaptureControlId aPostCaptureControlId)
sl@0
  1525
	{
sl@0
  1526
	iCaptureImageHandle = &aCaptureImageHandle;
sl@0
  1527
	iPostCaptureControlId = aPostCaptureControlId;
sl@0
  1528
	}
sl@0
  1529
	
sl@0
  1530
void RECamImgCaptureNotificationTest::ImageBufferReady(CCamera::CCameraImageCapture& aCaptureImageHandle, TPostCaptureControlId aPostCaptureControlId, TInt aErrorCode)
sl@0
  1531
	{
sl@0
  1532
	iCaptureImageHandle = &aCaptureImageHandle;
sl@0
  1533
	iPostCaptureControlId = aPostCaptureControlId;
sl@0
  1534
	iError = aErrorCode;
sl@0
  1535
	}
sl@0
  1536
	
sl@0
  1537
void RECamImgCaptureNotificationTest::ClientSnapshotForImageReady(CCamera::CCameraImageCapture& aCaptureImageHandle, TPostCaptureControlId aPostCaptureControlId, MCameraBuffer2* /*aSnapshotBuffer*/, TInt aErrorCode)
sl@0
  1538
	{
sl@0
  1539
	iCaptureImageHandle = &aCaptureImageHandle;
sl@0
  1540
	iPostCaptureControlId = aPostCaptureControlId;
sl@0
  1541
	iError = aErrorCode;
sl@0
  1542
	}
sl@0
  1543
	
sl@0
  1544
void RECamImgCaptureNotificationTest::DirectSnapshotForImageDisplayed(CCamera::CCameraImageCapture& aCaptureImageHandle, TPostCaptureControlId aPostCaptureControlId, TInt aErrorCode)
sl@0
  1545
	{
sl@0
  1546
	iCaptureImageHandle = &aCaptureImageHandle;
sl@0
  1547
	iPostCaptureControlId = aPostCaptureControlId;
sl@0
  1548
	iError = aErrorCode;
sl@0
  1549
	}
sl@0
  1550
	
sl@0
  1551
void RECamImgCaptureNotificationTest::CutDownImageDirectSavingCompleted(CCamera::CCameraImageCapture& aCaptureImageHandle, TPostCaptureControlId aPostCaptureControlId, TInt aErrorCode)
sl@0
  1552
	{
sl@0
  1553
	iCaptureImageHandle = &aCaptureImageHandle;
sl@0
  1554
	iPostCaptureControlId = aPostCaptureControlId;
sl@0
  1555
	iError = aErrorCode;	
sl@0
  1556
	}
sl@0
  1557
	
sl@0
  1558
void RECamImgCaptureNotificationTest::ImageDirectSavingCompleted(CCamera::CCameraImageCapture& aCaptureImageHandle, TPostCaptureControlId aPostCaptureControlId, TInt aErrorCode)
sl@0
  1559
	{
sl@0
  1560
	iCaptureImageHandle = &aCaptureImageHandle;
sl@0
  1561
	iPostCaptureControlId = aPostCaptureControlId;
sl@0
  1562
	iError = aErrorCode;	
sl@0
  1563
	}
sl@0
  1564
	
sl@0
  1565
void RECamImgCaptureNotificationTest::ImageCaptureComplete(CCamera::CCameraImageCapture& aCaptureImageHandle, TInt aErrorCode)
sl@0
  1566
	{
sl@0
  1567
	iCaptureImageHandle = &aCaptureImageHandle;
sl@0
  1568
	iError = aErrorCode;	
sl@0
  1569
	}
sl@0
  1570
	
sl@0
  1571
void RECamImgCaptureNotificationTest::ClientHistogramForImageReady(CCamera::CCameraImageCapture& aCaptureImageHandle, TPostCaptureControlId aPostCaptureControlId, MHistogramV2Buffer* /*aClientHistogramBuffer*/, TInt aErrorCode)
sl@0
  1572
	{
sl@0
  1573
	iCaptureImageHandle = &aCaptureImageHandle;
sl@0
  1574
	iPostCaptureControlId = aPostCaptureControlId;
sl@0
  1575
	iError = aErrorCode;		
sl@0
  1576
	}
sl@0
  1577
	
sl@0
  1578
void RECamImgCaptureNotificationTest::ClientHistogramForSnapshotReady(CCamera::CCameraImageCapture& aCaptureImageHandle, TPostCaptureControlId aPostCaptureControlId, MHistogramV2Buffer* /*aClientHistogramBuffer*/, TInt aErrorCode)
sl@0
  1579
	{
sl@0
  1580
	iCaptureImageHandle = &aCaptureImageHandle;
sl@0
  1581
	iPostCaptureControlId = aPostCaptureControlId;
sl@0
  1582
	iError = aErrorCode;	
sl@0
  1583
	}
sl@0
  1584
	
sl@0
  1585
void RECamImgCaptureNotificationTest::DirectHistogramForSnapshotDisplayed(CCamera::CCameraImageCapture& aCaptureImageHandle, TPostCaptureControlId aPostCaptureControlId, CCamera::CCameraV2Histogram& /*aDirectHistogramDisplayed*/, TInt aErrorCode)
sl@0
  1586
	{
sl@0
  1587
	iCaptureImageHandle = &aCaptureImageHandle;
sl@0
  1588
	iPostCaptureControlId = aPostCaptureControlId;
sl@0
  1589
	iError = aErrorCode;		
sl@0
  1590
	}
sl@0
  1591
	
sl@0
  1592
void RECamImgCaptureNotificationTest::ProcessingFailed(CCamera::CCameraImageCapture& aCaptureImageHandle, TPostCaptureControlId aPostCaptureControlId, TUint aProcessingTypes, TInt aErrorCode)
sl@0
  1593
	{
sl@0
  1594
	iCaptureImageHandle = &aCaptureImageHandle;
sl@0
  1595
	iPostCaptureControlId = aPostCaptureControlId;
sl@0
  1596
	iProcessingTypes = aProcessingTypes;
sl@0
  1597
	iError = aErrorCode;	
sl@0
  1598
	}
sl@0
  1599
sl@0
  1600
void RECamImgCaptureNotificationTest::CheckCaptureNotification(CCamera::CCameraImageCapture*& aImageCapture, TPostCaptureControlId& aPostCaptureControlId, TVerdict& aResult)
sl@0
  1601
	{
sl@0
  1602
	INFO_PRINTF2(_L("Image Capture Control Error %d, "), iError); 
sl@0
  1603
	if (iError != KErrNotSupported)
sl@0
  1604
		{
sl@0
  1605
	    aResult = EFail;
sl@0
  1606
	    }
sl@0
  1607
	else
sl@0
  1608
		{
sl@0
  1609
		aImageCapture = iCaptureImageHandle;
sl@0
  1610
		aPostCaptureControlId = iPostCaptureControlId;
sl@0
  1611
		}
sl@0
  1612
	}
sl@0
  1613
	
sl@0
  1614
void RECamImgCaptureNotificationTest::CheckCaptureCompletion(CCamera::CCameraImageCapture*& aImageCapture, TVerdict& aResult)
sl@0
  1615
	{
sl@0
  1616
	INFO_PRINTF2(_L("Image Capture Control Error %d, "), iError); 
sl@0
  1617
	if (iError != KErrNotSupported)
sl@0
  1618
		{
sl@0
  1619
	    aResult = EFail;
sl@0
  1620
	    }
sl@0
  1621
	else
sl@0
  1622
		{
sl@0
  1623
		aImageCapture = iCaptureImageHandle;
sl@0
  1624
		}
sl@0
  1625
	}
sl@0
  1626
	
sl@0
  1627
TVerdict RECamImgCaptureNotificationTest::DoTestStepL()
sl@0
  1628
	{
sl@0
  1629
	TVerdict verdict = EFail;
sl@0
  1630
	INFO_PRINTF1(_L("Alloc test"));
sl@0
  1631
	
sl@0
  1632
	TInt i,err;
sl@0
  1633
	
sl@0
  1634
	for (i = 1 ; ; i++)
sl@0
  1635
		{
sl@0
  1636
		__MM_HEAP_MARK;
sl@0
  1637
		
sl@0
  1638
		if (i % 5 == 0)
sl@0
  1639
			{
sl@0
  1640
			INFO_PRINTF2(_L("Fail count = %d"), i);
sl@0
  1641
			}
sl@0
  1642
sl@0
  1643
		__UHEAP_SETFAIL(RHeap::EFailNext, i);
sl@0
  1644
sl@0
  1645
		TRAP(err, verdict = DoImgCaptureAdvFuncConstruction());
sl@0
  1646
sl@0
  1647
		TAny* testAlloc = User::Alloc(1);
sl@0
  1648
		TBool heapTestingComplete = (testAlloc == NULL) && (err==KErrNone);
sl@0
  1649
		User::Free(testAlloc);
sl@0
  1650
sl@0
  1651
		__UHEAP_RESET;
sl@0
  1652
		__MM_HEAP_MARKEND;
sl@0
  1653
sl@0
  1654
		if ((err != KErrNoMemory && verdict == EPass) || heapTestingComplete)
sl@0
  1655
			{
sl@0
  1656
			INFO_PRINTF4(_L("err = %d, verdict = %d, Fail count = %d"), err, verdict, i);
sl@0
  1657
			INFO_PRINTF1(_L("Alloc testing completed successfully"));
sl@0
  1658
			verdict = EPass;
sl@0
  1659
			break;
sl@0
  1660
			}
sl@0
  1661
		}
sl@0
  1662
	return verdict;
sl@0
  1663
	}
sl@0
  1664
	
sl@0
  1665
TVerdict RECamImgCaptureNotificationTest::DoImgCaptureAdvFuncConstruction()
sl@0
  1666
	{
sl@0
  1667
	TVerdict result = EPass;
sl@0
  1668
	CCamera* camera = NULL;
sl@0
  1669
	
sl@0
  1670
	TInt error = KErrNone;
sl@0
  1671
	CCamera::CCameraPreImageCaptureControl* preImgCapture = NULL;
sl@0
  1672
	
sl@0
  1673
	// create pre image control object using New2L
sl@0
  1674
	__MM_HEAP_MARK;
sl@0
  1675
	INFO_PRINTF1(_L("Create camera using Camera::New2L() and MCameraObserver2"));
sl@0
  1676
	
sl@0
  1677
	TRAP(error, camera = CCamera::New2L(*this, 0,0));
sl@0
  1678
	if (error==KErrNone)
sl@0
  1679
		{
sl@0
  1680
		CleanupStack::PushL(camera);
sl@0
  1681
		INFO_PRINTF1(_L("KErrNone return from CCamera::New2L()"));
sl@0
  1682
		TRAP(error, preImgCapture = CCamera::CCameraPreImageCaptureControl::NewL(*camera, *this));	
sl@0
  1683
		
sl@0
  1684
		if (error==KErrNone)
sl@0
  1685
	    	{
sl@0
  1686
	    	CleanupStack::PushL(preImgCapture);
sl@0
  1687
	  		INFO_PRINTF1(_L("CCameraPreImageCaptureControl object was created using NewL")); 
sl@0
  1688
	    	
sl@0
  1689
	    	INFO_PRINTF1(_L("PrepareImageCapture for PreImageCaptureControl"));
sl@0
  1690
  			CCamera::CCameraPreImageCaptureControl::TPrepareImageParameters prepareImageParameters;
sl@0
  1691
   			preImgCapture->PrepareImageCapture(prepareImageParameters, *this);
sl@0
  1692
  			CCamera::CCameraImageCapture* imageCapture = NULL;
sl@0
  1693
			CheckPreCaptureNotification(imageCapture, result);	
sl@0
  1694
			
sl@0
  1695
			if(imageCapture == NULL)
sl@0
  1696
				{
sl@0
  1697
				INFO_PRINTF1(_L("CCameraImageCapture object not created!"));
sl@0
  1698
  				result = EFail;
sl@0
  1699
				}
sl@0
  1700
			else
sl@0
  1701
			    {
sl@0
  1702
			    CleanupStack::PushL(imageCapture);
sl@0
  1703
				// image capture opertions.
sl@0
  1704
				
sl@0
  1705
				INFO_PRINTF1(_L("Create Histogram for Image Capture"));
sl@0
  1706
				CCamera::CCameraV2Histogram* histogram_IC = NULL;
sl@0
  1707
		  		TRAP(error, histogram_IC = imageCapture->CreateHistogramHandleL());
sl@0
  1708
		  		
sl@0
  1709
		  		if(error != KErrNone /*|| !histogram_IC*/)
sl@0
  1710
		  			{
sl@0
  1711
		  			INFO_PRINTF1(_L("Histogram creation for Image Capture unsuccessful"));
sl@0
  1712
		  			result = EFail;
sl@0
  1713
		  			CleanupStack::PopAndDestroy(imageCapture);
sl@0
  1714
		  			CleanupStack::PopAndDestroy(preImgCapture);
sl@0
  1715
		  			CleanupStack::PopAndDestroy(camera);
sl@0
  1716
		  			User::Leave(error);
sl@0
  1717
		  			}
sl@0
  1718
		  			
sl@0
  1719
		  		CleanupStack::PushL(histogram_IC);
sl@0
  1720
		  			
sl@0
  1721
		  		INFO_PRINTF1(_L("Create ImageProcessing for Image Capture "));
sl@0
  1722
		  		
sl@0
  1723
		  		CCamera::CCameraImageProcessing* impProc = NULL;
sl@0
  1724
		  		TRAP(error, impProc = imageCapture->GetTransformationHandleL());
sl@0
  1725
	  			
sl@0
  1726
	  			if(error != KErrNone /*|| !impProc*/)
sl@0
  1727
	  				{
sl@0
  1728
	  				INFO_PRINTF1(_L("ImageProcessing creation for Image Capture unsuccessful"));
sl@0
  1729
	  				result = EFail;
sl@0
  1730
	  				CleanupStack::PopAndDestroy(histogram_IC);
sl@0
  1731
	  				CleanupStack::PopAndDestroy(imageCapture);
sl@0
  1732
		  			CleanupStack::PopAndDestroy(preImgCapture);
sl@0
  1733
		  			CleanupStack::PopAndDestroy(camera);
sl@0
  1734
					User::Leave(error);
sl@0
  1735
	  				}
sl@0
  1736
	  				
sl@0
  1737
	  			CleanupStack::PushL(impProc);
sl@0
  1738
	  				
sl@0
  1739
	  			INFO_PRINTF1(_L("Create snapshot for Image Capture"));
sl@0
  1740
	  			TInt viewfinderID = 0;
sl@0
  1741
	  			CCamera::CCameraSnapshot* snapshot_IC = NULL;
sl@0
  1742
		  		TRAP(error,snapshot_IC = imageCapture->GetSnapshotHandleL(viewfinderID));
sl@0
  1743
	  			
sl@0
  1744
	  			if(error != KErrNone /*||!snapshot_IC*/)
sl@0
  1745
	  				{
sl@0
  1746
	  				INFO_PRINTF1(_L("snapshot creation for Image Capture : unexpected result!"));
sl@0
  1747
	  				result = EFail;
sl@0
  1748
	  				CleanupStack::PopAndDestroy(impProc);
sl@0
  1749
	  				CleanupStack::PopAndDestroy(histogram_IC);
sl@0
  1750
	  				CleanupStack::PopAndDestroy(imageCapture);
sl@0
  1751
		  			CleanupStack::PopAndDestroy(preImgCapture);
sl@0
  1752
		  			CleanupStack::PopAndDestroy(camera);
sl@0
  1753
					User::Leave(error);
sl@0
  1754
	  				}
sl@0
  1755
				CleanupStack::PushL(snapshot_IC);
sl@0
  1756
				
sl@0
  1757
				INFO_PRINTF1(_L("Create histogram for snapshot for Image Capture"));
sl@0
  1758
				CCamera::CCameraV2Histogram* histogram_snapshot_IC = NULL;
sl@0
  1759
		  		
sl@0
  1760
		  		TRAP(error, histogram_snapshot_IC = snapshot_IC->CreateHistogramHandleL());
sl@0
  1761
		  		
sl@0
  1762
		  		if(error != KErrNone /*|| !histogram_snapshot_IC*/)
sl@0
  1763
		  			{
sl@0
  1764
		  			INFO_PRINTF1(_L("Histogram creation for snapshot for Image Capture unsuccessful"));
sl@0
  1765
		  			result = EFail;
sl@0
  1766
		  			CleanupStack::PopAndDestroy(snapshot_IC);
sl@0
  1767
	  				CleanupStack::PopAndDestroy(impProc);
sl@0
  1768
	  				CleanupStack::PopAndDestroy(histogram_IC);
sl@0
  1769
	  				CleanupStack::PopAndDestroy(imageCapture);
sl@0
  1770
		  			CleanupStack::PopAndDestroy(preImgCapture);
sl@0
  1771
		  			CleanupStack::PopAndDestroy(camera);
sl@0
  1772
					User::Leave(error);
sl@0
  1773
		  			}
sl@0
  1774
		  		CleanupStack::PushL(histogram_snapshot_IC);
sl@0
  1775
		  		
sl@0
  1776
		  		//check img proc for image capture
sl@0
  1777
		  		INFO_PRINTF1(_L("GetSupportedTransformationsL for imgProc for Image Capture"));
sl@0
  1778
		  		RArray<TUid> transformations;
sl@0
  1779
		  		TRAPD(err, impProc->GetSupportedTransformationsL(transformations));
sl@0
  1780
		  		if(err != KErrNone)
sl@0
  1781
		  			{
sl@0
  1782
		  			INFO_PRINTF1(_L("GetSupportedTransformationsL for imgProc for Image Capture : unexpected result!"));
sl@0
  1783
		  			result = EFail;
sl@0
  1784
		  			CleanupStack::PopAndDestroy(histogram_snapshot_IC);
sl@0
  1785
		  			CleanupStack::PopAndDestroy(snapshot_IC);
sl@0
  1786
	  				CleanupStack::PopAndDestroy(impProc);
sl@0
  1787
	  				CleanupStack::PopAndDestroy(histogram_IC);
sl@0
  1788
	  				CleanupStack::PopAndDestroy(imageCapture);
sl@0
  1789
		  			CleanupStack::PopAndDestroy(preImgCapture);
sl@0
  1790
		  			CleanupStack::PopAndDestroy(camera);
sl@0
  1791
					User::Leave(err);
sl@0
  1792
		  			}
sl@0
  1793
		  		if(transformations.Count() != 0)
sl@0
  1794
		  			{
sl@0
  1795
		  			INFO_PRINTF1(_L("Number of SupportedTransformations for imgProc for Image Capture : unexpected result!"));
sl@0
  1796
		  			result = EFail;
sl@0
  1797
		  			}
sl@0
  1798
		  		transformations.Close();
sl@0
  1799
		  		
sl@0
  1800
		  		INFO_PRINTF1(_L("Check New Img Proc methods for Image Capture"));
sl@0
  1801
		  		CCamera::CCameraImageProcessing::TOrientationReference orientationRef 
sl@0
  1802
		  				= CCamera::CCameraImageProcessing::EOrientationReferenceTiltOrientation;
sl@0
  1803
		  		TUint suppRelativeRotation=0;
sl@0
  1804
		  		TUint supportedRelMirroring=0;
sl@0
  1805
		  		TUint supportedRelFlipping=0;
sl@0
  1806
		  		TRAP(err, impProc->GetSupportedRelativeOrientationOptionsL(orientationRef, suppRelativeRotation, supportedRelMirroring, supportedRelFlipping));
sl@0
  1807
		  		if(err != KErrNotSupported)
sl@0
  1808
		  			{
sl@0
  1809
		  			INFO_PRINTF1(_L("GetSupportedRelativeOrientationOptionsL for imgProc for Image Capture : unexpected result!"));
sl@0
  1810
		  			result = EFail;
sl@0
  1811
		  			}
sl@0
  1812
		  		
sl@0
  1813
		  		CCamera::CCameraImageProcessing::TRelativeRotation relRotation = 
sl@0
  1814
		  					CCamera::CCameraImageProcessing::ERelativeRotation0Degrees;
sl@0
  1815
		  			
sl@0
  1816
		  		CCamera::CCameraImageProcessing::TRelativeMirror relMirror =
sl@0
  1817
		  					CCamera::CCameraImageProcessing::ERelativeMirrorNone;
sl@0
  1818
		  					
sl@0
  1819
		  		CCamera::CCameraImageProcessing::TRelativeFlipping relFlipping =
sl@0
  1820
		  					CCamera::CCameraImageProcessing::ERelativeFlippingNone;
sl@0
  1821
		  		
sl@0
  1822
		  		TRAP(err, impProc->GetCurrentRelativeOrientationOptionsL(orientationRef, relRotation, relMirror, relFlipping));
sl@0
  1823
		  		if(err != KErrNotSupported)
sl@0
  1824
		  			{
sl@0
  1825
		  			INFO_PRINTF1(_L("GetCurrentRelativeOrientationOptionsL for imgProc for Image Capture : unexpected result!"));
sl@0
  1826
		  			result = EFail;
sl@0
  1827
		  			CleanupStack::PopAndDestroy(histogram_snapshot_IC);
sl@0
  1828
		  			CleanupStack::PopAndDestroy(snapshot_IC);
sl@0
  1829
	  				CleanupStack::PopAndDestroy(impProc);
sl@0
  1830
	  				CleanupStack::PopAndDestroy(histogram_IC);
sl@0
  1831
	  				CleanupStack::PopAndDestroy(imageCapture);
sl@0
  1832
		  			CleanupStack::PopAndDestroy(preImgCapture);
sl@0
  1833
		  			CleanupStack::PopAndDestroy(camera);
sl@0
  1834
					User::Leave(err);
sl@0
  1835
		  			}
sl@0
  1836
		  			
sl@0
  1837
		  		TRAP(err, impProc->SetRelativeOrientationOptionsL(orientationRef, relRotation, relMirror, relFlipping));
sl@0
  1838
		  		if(err != KErrNotSupported)
sl@0
  1839
		  			{
sl@0
  1840
		  			INFO_PRINTF1(_L("SetRelativeOrientationOptionsL for imgProc for Image Capture : unexpected result!"));
sl@0
  1841
		  			result = EFail;
sl@0
  1842
		  			CleanupStack::PopAndDestroy(histogram_snapshot_IC);
sl@0
  1843
		  			CleanupStack::PopAndDestroy(snapshot_IC);
sl@0
  1844
	  				CleanupStack::PopAndDestroy(impProc);
sl@0
  1845
	  				CleanupStack::PopAndDestroy(histogram_IC);
sl@0
  1846
	  				CleanupStack::PopAndDestroy(imageCapture);
sl@0
  1847
		  			CleanupStack::PopAndDestroy(preImgCapture);
sl@0
  1848
		  			CleanupStack::PopAndDestroy(camera);
sl@0
  1849
					User::Leave(err);
sl@0
  1850
		  			}
sl@0
  1851
												
sl@0
  1852
		  		//prepare histogram for image capture
sl@0
  1853
		  		INFO_PRINTF1(_L("PrepareClientHistogramL for Histogram for Image Capture"));
sl@0
  1854
		  		CCamera::CCameraV2Histogram::THistogramType histogramType = CCamera::CCameraV2Histogram::EHistNone;
sl@0
  1855
		  		TRAP(err,histogram_IC->PrepareClientHistogramL(histogramType));
sl@0
  1856
	  			if(err != KErrNotSupported)
sl@0
  1857
	  				{
sl@0
  1858
	  				INFO_PRINTF1(_L("PrepareClientHistogramL for Histogram for Image Capture: unexpected result!"));
sl@0
  1859
	  				result = EFail;
sl@0
  1860
	  				CleanupStack::PopAndDestroy(histogram_snapshot_IC);
sl@0
  1861
		  			CleanupStack::PopAndDestroy(snapshot_IC);
sl@0
  1862
	  				CleanupStack::PopAndDestroy(impProc);
sl@0
  1863
	  				CleanupStack::PopAndDestroy(histogram_IC);
sl@0
  1864
	  				CleanupStack::PopAndDestroy(imageCapture);
sl@0
  1865
		  			CleanupStack::PopAndDestroy(preImgCapture);
sl@0
  1866
		  			CleanupStack::PopAndDestroy(camera);
sl@0
  1867
					User::Leave(err);
sl@0
  1868
	  				}
sl@0
  1869
	  				
sl@0
  1870
	  			//prepare snapshot for image capture
sl@0
  1871
	  			INFO_PRINTF1(_L("PrepareSnapshotL for Snapshot for Image Capture"));
sl@0
  1872
				CCamera::CCameraSnapshot::TSnapshotParameters snapshotParam;
sl@0
  1873
		   		TRAP(err,snapshot_IC->PrepareSnapshotL(snapshotParam));
sl@0
  1874
		   		if(err != KErrNone)
sl@0
  1875
		   			{
sl@0
  1876
		   			INFO_PRINTF1(_L("PrepareSnapshotL for Snapshot for Image Capture: unexpected result!"));
sl@0
  1877
	  				result = EFail;
sl@0
  1878
	  				CleanupStack::PopAndDestroy(histogram_snapshot_IC);
sl@0
  1879
		  			CleanupStack::PopAndDestroy(snapshot_IC);
sl@0
  1880
	  				CleanupStack::PopAndDestroy(impProc);
sl@0
  1881
	  				CleanupStack::PopAndDestroy(histogram_IC);
sl@0
  1882
	  				CleanupStack::PopAndDestroy(imageCapture);
sl@0
  1883
		  			CleanupStack::PopAndDestroy(preImgCapture);
sl@0
  1884
		  			CleanupStack::PopAndDestroy(camera);
sl@0
  1885
					User::Leave(err);
sl@0
  1886
		   			}
sl@0
  1887
		   			
sl@0
  1888
		   		//prepare histogram for snapshot for image capture
sl@0
  1889
		  		INFO_PRINTF1(_L("PrepareClientHistogramL for Histogram for snapshot for Image Capture"));
sl@0
  1890
		  		TRAP(err,histogram_snapshot_IC->PrepareClientHistogramL(histogramType));
sl@0
  1891
	  			if(err != KErrNotSupported)
sl@0
  1892
	  				{
sl@0
  1893
	  				INFO_PRINTF1(_L("PrepareClientHistogramL for Histogram for Snapshot for Image Capture: unexpected result!"));
sl@0
  1894
	  				result = EFail;
sl@0
  1895
	  				CleanupStack::PopAndDestroy(histogram_snapshot_IC);
sl@0
  1896
		  			CleanupStack::PopAndDestroy(snapshot_IC);
sl@0
  1897
	  				CleanupStack::PopAndDestroy(impProc);
sl@0
  1898
	  				CleanupStack::PopAndDestroy(histogram_IC);
sl@0
  1899
	  				CleanupStack::PopAndDestroy(imageCapture);
sl@0
  1900
		  			CleanupStack::PopAndDestroy(preImgCapture);
sl@0
  1901
		  			CleanupStack::PopAndDestroy(camera);
sl@0
  1902
					User::Leave(err);
sl@0
  1903
	  				}
sl@0
  1904
	  				
sl@0
  1905
	  			//image capture operations
sl@0
  1906
	  			INFO_PRINTF1(_L("GetPrepareImageParametersL for Image Capture"));
sl@0
  1907
	  			CCamera::CCameraPreImageCaptureControl::TPrepareImageParameters prepareImageParameters;
sl@0
  1908
		  		TRAP(err,imageCapture->GetPrepareImageParametersL(prepareImageParameters));
sl@0
  1909
	  			if(err != KErrNone)
sl@0
  1910
	  				{
sl@0
  1911
	  				INFO_PRINTF1(_L("GetPrepareImageParametersL for Image Capture: unexpected result!"));
sl@0
  1912
	  				result = EFail;
sl@0
  1913
	  				CleanupStack::PopAndDestroy(histogram_snapshot_IC);
sl@0
  1914
		  			CleanupStack::PopAndDestroy(snapshot_IC);
sl@0
  1915
	  				CleanupStack::PopAndDestroy(impProc);
sl@0
  1916
	  				CleanupStack::PopAndDestroy(histogram_IC);
sl@0
  1917
	  				CleanupStack::PopAndDestroy(imageCapture);
sl@0
  1918
		  			CleanupStack::PopAndDestroy(preImgCapture);
sl@0
  1919
		  			CleanupStack::PopAndDestroy(camera);
sl@0
  1920
					User::Leave(err);
sl@0
  1921
	  				}
sl@0
  1922
	  				
sl@0
  1923
	  			INFO_PRINTF1(_L("CaptureImage for Image Capture"));
sl@0
  1924
	  			imageCapture->CaptureImage();
sl@0
  1925
	  			
sl@0
  1926
	  			CCamera::CCameraImageCapture* captImg = NULL;
sl@0
  1927
	  			CCamera::CCameraPostImageCaptureControl* postImgCapt = NULL;
sl@0
  1928
	  			TPostCaptureControlId postCaptureControlId = 0;
sl@0
  1929
	  			
sl@0
  1930
	  			TRAP(err, iCaptureImageHandle->GetPostCaptureControlHandleL(postImgCapt, iPostCaptureControlId));
sl@0
  1931
	  			if(err != KErrNone)
sl@0
  1932
	  				{
sl@0
  1933
	  				INFO_PRINTF1(_L("GetPostCaptureControlHandleL for Image Capture: unexpected result!"));
sl@0
  1934
	  				result = EFail;
sl@0
  1935
	  				CleanupStack::PopAndDestroy(histogram_snapshot_IC);
sl@0
  1936
		  			CleanupStack::PopAndDestroy(snapshot_IC);
sl@0
  1937
	  				CleanupStack::PopAndDestroy(impProc);
sl@0
  1938
	  				CleanupStack::PopAndDestroy(histogram_IC);
sl@0
  1939
	  				CleanupStack::PopAndDestroy(imageCapture);
sl@0
  1940
		  			CleanupStack::PopAndDestroy(preImgCapture);
sl@0
  1941
		  			CleanupStack::PopAndDestroy(camera);
sl@0
  1942
					User::Leave(err);
sl@0
  1943
	  				}
sl@0
  1944
	  				
sl@0
  1945
	  			if(postImgCapt == NULL)
sl@0
  1946
	  				{
sl@0
  1947
	  				INFO_PRINTF1(_L("PostCaptureControl object was not provided for Image Capture: unexpected result!"));
sl@0
  1948
	  				result = EFail;
sl@0
  1949
	  				}
sl@0
  1950
	  			else
sl@0
  1951
	  				{
sl@0
  1952
	  				CleanupStack::PushL(postImgCapt);
sl@0
  1953
	  				//perform operations on post image capture control
sl@0
  1954
	  				INFO_PRINTF1(_L("GetPostCaptureControlId for post imgCapt object for Image Capture"));
sl@0
  1955
	  				TPostCaptureControlId postCaptCtrlId = 0;
sl@0
  1956
	  				postImgCapt->GetPostCaptureControlId(postCaptCtrlId);
sl@0
  1957
	  				if(postCaptCtrlId != iPostCaptureControlId)
sl@0
  1958
	  					{
sl@0
  1959
	  					INFO_PRINTF1(_L("PostCaptureControlId unexpected!"));
sl@0
  1960
	  					result = EFail;
sl@0
  1961
	  					}
sl@0
  1962
	  				postCaptureControlId = postCaptCtrlId;
sl@0
  1963
	  					
sl@0
  1964
	  				INFO_PRINTF1(_L("ImageCaptureHandle for post imgCapt object for Image Capture"));
sl@0
  1965
	  				TRAP(err, CCamera::CCameraImageCapture* captImg1 = postImgCapt->ImageCaptureHandle());
sl@0
  1966
					if(err != KErrNone /*|| captImg1 == NULL*/)
sl@0
  1967
						{
sl@0
  1968
						INFO_PRINTF1(_L("CCameraImageCapture object from post image capture object is NULL and unexpected!"));
sl@0
  1969
	  					result = EFail;
sl@0
  1970
	  					CleanupStack::PopAndDestroy(postImgCapt);
sl@0
  1971
						CleanupStack::PopAndDestroy(histogram_snapshot_IC);
sl@0
  1972
			  			CleanupStack::PopAndDestroy(snapshot_IC);
sl@0
  1973
		  				CleanupStack::PopAndDestroy(impProc);
sl@0
  1974
		  				CleanupStack::PopAndDestroy(histogram_IC);
sl@0
  1975
		  				CleanupStack::PopAndDestroy(imageCapture);
sl@0
  1976
			  			CleanupStack::PopAndDestroy(preImgCapture);
sl@0
  1977
			  			CleanupStack::PopAndDestroy(camera);
sl@0
  1978
						User::Leave(err);
sl@0
  1979
						}
sl@0
  1980
						
sl@0
  1981
					INFO_PRINTF1(_L("GetImageSequenceNumberL for post imgCapt object for Image Capture"));
sl@0
  1982
	  				TUint seqNum = 0;
sl@0
  1983
	  				TRAP(err, postImgCapt->GetImageSequenceNumberL(seqNum));
sl@0
  1984
	  				if(err != KErrNotSupported)
sl@0
  1985
						{
sl@0
  1986
						INFO_PRINTF1(_L("GetImageSequenceNumberL for post image capture object unexpected!"));
sl@0
  1987
	  					result = EFail;
sl@0
  1988
						}
sl@0
  1989
						
sl@0
  1990
					INFO_PRINTF1(_L("SetImagePriorityL for post imgCapt object for Image Capture"));
sl@0
  1991
	  				TECamImagePriority imagePriority = EECamImagePriorityLow;
sl@0
  1992
	  				TRAP(err, postImgCapt->SetImagePriorityL(imagePriority));
sl@0
  1993
	  				if(err != KErrNotSupported)
sl@0
  1994
						{
sl@0
  1995
						INFO_PRINTF1(_L("SetImagePriorityL for post image capture object unexpected!"));
sl@0
  1996
	  					result = EFail;
sl@0
  1997
						}
sl@0
  1998
						
sl@0
  1999
					INFO_PRINTF1(_L("GetImagePriorityL for post imgCapt object for Image Capture"));
sl@0
  2000
	  				TRAP(err, postImgCapt->GetImagePriorityL(imagePriority));
sl@0
  2001
	  				if(err != KErrNotSupported)
sl@0
  2002
						{
sl@0
  2003
						INFO_PRINTF1(_L("GetImagePriorityL for post image capture object unexpected!"));
sl@0
  2004
	  					result = EFail;
sl@0
  2005
						}
sl@0
  2006
						
sl@0
  2007
					INFO_PRINTF1(_L("PauseProcessing for post imgCapt object for Image Capture"));
sl@0
  2008
	  				postImgCapt->PauseProcessing(0);
sl@0
  2009
	  				
sl@0
  2010
	  				INFO_PRINTF1(_L("ResumeProcessingL for post imgCapt object for Image Capture"));
sl@0
  2011
	  				TRAP(err, postImgCapt->ResumeProcessingL(0));
sl@0
  2012
	  				if(err != KErrNotSupported)
sl@0
  2013
						{
sl@0
  2014
						INFO_PRINTF1(_L("ResumeProcessingL for post image capture object unexpected!"));
sl@0
  2015
	  					result = EFail;
sl@0
  2016
						}
sl@0
  2017
					
sl@0
  2018
					INFO_PRINTF1(_L("GetImageStateL for post imgCapt object for Image Capture"));
sl@0
  2019
	  				CCamera::CCameraPostImageCaptureControl::TImageState imgState = 
sl@0
  2020
	  						CCamera::CCameraPostImageCaptureControl::EProcessingPending;
sl@0
  2021
	  				TRAP(err, postImgCapt->GetImageStateL(imgState));
sl@0
  2022
	  				if(err != KErrNotSupported)
sl@0
  2023
						{
sl@0
  2024
						INFO_PRINTF1(_L("GetImageStateL for post image capture object unexpected!"));
sl@0
  2025
	  					result = EFail;
sl@0
  2026
						}
sl@0
  2027
						
sl@0
  2028
					INFO_PRINTF1(_L("GetBufferStateL for post imgCapt object for Image Capture"));
sl@0
  2029
	  				CCamera::CCameraPostImageCaptureControl::TBufferState bufferState = 
sl@0
  2030
	  						CCamera::CCameraPostImageCaptureControl::EBufferNotPresent;
sl@0
  2031
	  				TRAP(err, postImgCapt->GetBufferStateL(bufferState));
sl@0
  2032
	  				if(err != KErrNotSupported)
sl@0
  2033
						{
sl@0
  2034
						INFO_PRINTF1(_L("GetBufferStateL for post image capture object unexpected!"));
sl@0
  2035
	  					result = EFail;
sl@0
  2036
						}
sl@0
  2037
						
sl@0
  2038
					INFO_PRINTF1(_L("GetImageBufferL for post imgCapt object for Image Capture"));
sl@0
  2039
	  				MCameraImageBuffer* cameraImageBuffer = NULL;
sl@0
  2040
	  				TRAP(err, postImgCapt->GetImageBufferL(*cameraImageBuffer));
sl@0
  2041
	  				if(err != KErrNotSupported)
sl@0
  2042
						{
sl@0
  2043
						INFO_PRINTF1(_L("GetImageBufferL for post image capture object unexpected!"));
sl@0
  2044
	  					result = EFail;
sl@0
  2045
						}
sl@0
  2046
						
sl@0
  2047
					INFO_PRINTF1(_L("CancelImage for post imgCapt object for Image Capture"));
sl@0
  2048
	  				postImgCapt->CancelImage();
sl@0
  2049
	  				}
sl@0
  2050
	  				
sl@0
  2051
	  			CheckCaptureCompletion(captImg, result);
sl@0
  2052
	  			
sl@0
  2053
	  			//perform operations on image capture
sl@0
  2054
	  			INFO_PRINTF1(_L("GetNumImagesExposedL for Image Capture"));
sl@0
  2055
	  			TUint numImagesExposed = 0;
sl@0
  2056
	  			TRAP(err, imageCapture->GetNumImagesExposedL(numImagesExposed));
sl@0
  2057
	  			if(err != KErrNotSupported)
sl@0
  2058
					{
sl@0
  2059
					INFO_PRINTF1(_L("GetNumImagesExposedL for Image Capture unexpected!"));
sl@0
  2060
  					result = EFail;
sl@0
  2061
					}
sl@0
  2062
					
sl@0
  2063
				INFO_PRINTF1(_L("GetNumTotalImagesL for Image Capture"));
sl@0
  2064
	  			TRAP(err, imageCapture->GetNumTotalImagesL(numImagesExposed));
sl@0
  2065
	  			if(err != KErrNone)
sl@0
  2066
					{
sl@0
  2067
					INFO_PRINTF1(_L("GetNumTotalImagesL for Image Capture unexpected!"));
sl@0
  2068
  					result = EFail;
sl@0
  2069
					}
sl@0
  2070
					
sl@0
  2071
				INFO_PRINTF1(_L("SetCaptureImagePriorityL for Image Capture"));
sl@0
  2072
				TECamImagePriority imagePriority = EECamImagePriorityLow;
sl@0
  2073
	  			TRAP(err, imageCapture->SetCaptureImagePriorityL(imagePriority));
sl@0
  2074
	  			if(err != KErrNotSupported)
sl@0
  2075
					{
sl@0
  2076
					INFO_PRINTF1(_L("SetCaptureImagePriorityL for Image Capture unexpected!"));
sl@0
  2077
  					result = EFail;
sl@0
  2078
					}
sl@0
  2079
				
sl@0
  2080
				INFO_PRINTF1(_L("GetCaptureImagePriorityL for Image Capture"));
sl@0
  2081
	  			TRAP(err, imageCapture->GetCaptureImagePriorityL(imagePriority));
sl@0
  2082
	  			if(err != KErrNotSupported)
sl@0
  2083
					{
sl@0
  2084
					INFO_PRINTF1(_L("GetCaptureImagePriorityL for Image Capture unexpected!"));
sl@0
  2085
  					result = EFail;
sl@0
  2086
					}
sl@0
  2087
					
sl@0
  2088
				INFO_PRINTF1(_L("PauseProcessing for Image Capture"));
sl@0
  2089
	  			imageCapture->PauseProcessing(0);
sl@0
  2090
	  			
sl@0
  2091
	  			INFO_PRINTF1(_L("ResumeProcessingL for Image Capture"));
sl@0
  2092
  				TRAP(err, imageCapture->ResumeProcessingL(0));
sl@0
  2093
  				if(err != KErrNotSupported)
sl@0
  2094
					{
sl@0
  2095
					INFO_PRINTF1(_L("ResumeProcessingL for Image Capture unexpected!"));
sl@0
  2096
  					result = EFail;
sl@0
  2097
					}
sl@0
  2098
				
sl@0
  2099
				INFO_PRINTF1(_L("CancelCaptureImage for Image Capture"));
sl@0
  2100
	  			imageCapture->CancelCaptureImage();
sl@0
  2101
	  			
sl@0
  2102
	  			//start histogram for image capture
sl@0
  2103
	  			INFO_PRINTF1(_L("StartHistogram for Image Capture"));
sl@0
  2104
				histogram_IC->StartHistogram();
sl@0
  2105
				CCamera::CCameraImageCapture* camImgCapture=NULL;
sl@0
  2106
				TPostCaptureControlId postCaptCtrlId = 0;
sl@0
  2107
				CheckCaptureNotification(camImgCapture, postCaptCtrlId, result);
sl@0
  2108
				if(camImgCapture == NULL || postCaptCtrlId != postCaptureControlId)
sl@0
  2109
					{
sl@0
  2110
					INFO_PRINTF1(_L("StartHistogram for Histogram for Image Capture unexpected!"));
sl@0
  2111
  					result = EFail;	
sl@0
  2112
					}
sl@0
  2113
	  		
sl@0
  2114
	  			INFO_PRINTF1(_L("StopHistogram for histogram for Image Capture"));	
sl@0
  2115
				histogram_IC->StopHistogram();
sl@0
  2116
				
sl@0
  2117
				//start snapshot for image capture
sl@0
  2118
				INFO_PRINTF1(_L("EnableSnapshotL for snapshot for Image Capture"));	
sl@0
  2119
				TRAP(err,snapshot_IC->EnableSnapshotL());
sl@0
  2120
				if(err != KErrNone)
sl@0
  2121
					{
sl@0
  2122
		   			INFO_PRINTF1(_L("EnableSnapshotL for snapshot for Image Capture: unexpected result!"));
sl@0
  2123
	  				result = EFail;
sl@0
  2124
		   			}
sl@0
  2125
		   		camImgCapture = NULL;
sl@0
  2126
		   		camImgCapture = 0;
sl@0
  2127
		   		CheckCaptureNotification(camImgCapture, postCaptCtrlId, result);
sl@0
  2128
				if(camImgCapture == NULL || postCaptCtrlId != postCaptureControlId)
sl@0
  2129
					{
sl@0
  2130
					INFO_PRINTF1(_L("EnableSnapshotL for snapshot for Image Capture unexpected!"));
sl@0
  2131
  					result = EFail;	
sl@0
  2132
					}
sl@0
  2133
					
sl@0
  2134
				//start histogram for snapshot for image capture
sl@0
  2135
	  			INFO_PRINTF1(_L("StartHistogram for snapshot for Image Capture"));
sl@0
  2136
				histogram_snapshot_IC->StartHistogram();
sl@0
  2137
				camImgCapture=NULL;
sl@0
  2138
				postCaptCtrlId = 0;
sl@0
  2139
				CheckCaptureNotification(camImgCapture, postCaptCtrlId, result);
sl@0
  2140
				if(camImgCapture == NULL || postCaptCtrlId != postCaptureControlId)
sl@0
  2141
					{
sl@0
  2142
					INFO_PRINTF1(_L("StartHistogram for Histogram for snapshot for Image Capture unexpected!"));
sl@0
  2143
  					result = EFail;	
sl@0
  2144
					}
sl@0
  2145
	  		
sl@0
  2146
	  			INFO_PRINTF1(_L("StopHistogram for histogram for snapshot for Image Capture"));	
sl@0
  2147
				histogram_snapshot_IC->StopHistogram();	
sl@0
  2148
				//
sl@0
  2149
					
sl@0
  2150
				INFO_PRINTF1(_L("DisableSnapshotL for snapshot for Image Capture"));	
sl@0
  2151
				TRAP(err,snapshot_IC->DisableSnapshotL());
sl@0
  2152
				if(err != KErrNone)
sl@0
  2153
					{
sl@0
  2154
		   			INFO_PRINTF1(_L("DisableSnapshotL for snapshot for Image Capture: unexpected result!"));
sl@0
  2155
	  				result = EFail;
sl@0
  2156
		   			}
sl@0
  2157
	  		 	
sl@0
  2158
				CleanupStack::PopAndDestroy(postImgCapt);
sl@0
  2159
				CleanupStack::PopAndDestroy(histogram_snapshot_IC);
sl@0
  2160
				CleanupStack::PopAndDestroy(snapshot_IC);
sl@0
  2161
				CleanupStack::PopAndDestroy(impProc);
sl@0
  2162
				CleanupStack::PopAndDestroy(histogram_IC);
sl@0
  2163
				CleanupStack::PopAndDestroy(imageCapture);
sl@0
  2164
				}
sl@0
  2165
			CleanupStack::PopAndDestroy(preImgCapture);
sl@0
  2166
	    	}
sl@0
  2167
	    else
sl@0
  2168
    		{
sl@0
  2169
    		INFO_PRINTF1(_L("CCameraPreImageCaptureControl object was not created using NewL")); 
sl@0
  2170
    		result = EFail;
sl@0
  2171
    		}	
sl@0
  2172
		CleanupStack::PopAndDestroy(camera);
sl@0
  2173
		}
sl@0
  2174
	else 
sl@0
  2175
		{
sl@0
  2176
		INFO_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
sl@0
  2177
		result = EFail;		
sl@0
  2178
		}
sl@0
  2179
	__MM_HEAP_MARKEND;
sl@0
  2180
   
sl@0
  2181
	return result;	
sl@0
  2182
	}
sl@0
  2183
	
sl@0
  2184
/*------------------------------------------------------
sl@0
  2185
 	Video Capture Control : RECamVideoCaptureControlTest
sl@0
  2186
 *------------------------------------------------------*/
sl@0
  2187
RECamVideoCaptureControlTest* RECamVideoCaptureControlTest::NewL(const TDesC& aTestStep)
sl@0
  2188
	{
sl@0
  2189
	RECamVideoCaptureControlTest* self = new (ELeave) RECamVideoCaptureControlTest(aTestStep);
sl@0
  2190
	return self;	
sl@0
  2191
	}
sl@0
  2192
	
sl@0
  2193
RECamVideoCaptureControlTest::RECamVideoCaptureControlTest(const TDesC& aTestStep)
sl@0
  2194
	{
sl@0
  2195
	iTestStepName.Copy(aTestStep);
sl@0
  2196
	}
sl@0
  2197
	
sl@0
  2198
TVerdict RECamVideoCaptureControlTest::DoTestStepL()
sl@0
  2199
	{
sl@0
  2200
	if(!iTestStepName.Compare(_L("MM-ECM-ADV-U-056-HP")))
sl@0
  2201
		{
sl@0
  2202
		return DoTestStep_56L();
sl@0
  2203
		}
sl@0
  2204
	return EInconclusive;	
sl@0
  2205
	}
sl@0
  2206
sl@0
  2207
TVerdict RECamVideoCaptureControlTest::DoTestStep_56L()
sl@0
  2208
	{
sl@0
  2209
	TVerdict verdict = EFail;
sl@0
  2210
	INFO_PRINTF1(_L("Alloc test"));
sl@0
  2211
	TInt i;
sl@0
  2212
	TInt err;
sl@0
  2213
	for (i = 1 ; ; i++)
sl@0
  2214
		{
sl@0
  2215
		__MM_HEAP_MARK;
sl@0
  2216
		
sl@0
  2217
		if (i % 5 == 0)
sl@0
  2218
			{
sl@0
  2219
			INFO_PRINTF2(_L("Fail count = %d"), i);
sl@0
  2220
			}
sl@0
  2221
sl@0
  2222
		__UHEAP_SETFAIL(RHeap::EFailNext, i);
sl@0
  2223
sl@0
  2224
		TRAP(err, verdict = DoVideoCaptureTestStepL());
sl@0
  2225
sl@0
  2226
		TAny* testAlloc = User::Alloc(1);
sl@0
  2227
		TBool heapTestingComplete = (testAlloc == NULL) && (err==KErrNone);
sl@0
  2228
		User::Free(testAlloc);
sl@0
  2229
sl@0
  2230
		__UHEAP_RESET;
sl@0
  2231
		__MM_HEAP_MARKEND;
sl@0
  2232
sl@0
  2233
		if ((err != KErrNoMemory ) || heapTestingComplete)
sl@0
  2234
			{
sl@0
  2235
			INFO_PRINTF4(_L("err = %d, verdict = %d, Fail count = %d"), err, verdict, i);
sl@0
  2236
			INFO_PRINTF1(_L("Alloc testing completed successfully"));
sl@0
  2237
			verdict = EPass;
sl@0
  2238
			break;
sl@0
  2239
			}
sl@0
  2240
		}
sl@0
  2241
	return verdict;
sl@0
  2242
	}
sl@0
  2243
sl@0
  2244
TVerdict RECamVideoCaptureControlTest::DoVideoCaptureTestStepL()
sl@0
  2245
	{
sl@0
  2246
	TVerdict result = EPass;
sl@0
  2247
	CCamera* camera = NULL;
sl@0
  2248
sl@0
  2249
	MCaptureVideoObserver* videoCaptureObserver = NULL;
sl@0
  2250
	
sl@0
  2251
	TInt error = KErrNone;
sl@0
  2252
	CCamera::CCameraVideoCaptureControl* videoCapture = NULL;
sl@0
  2253
	
sl@0
  2254
	// using observer 	
sl@0
  2255
	__MM_HEAP_MARK;
sl@0
  2256
	MCameraObserver* observer=NULL;
sl@0
  2257
	INFO_PRINTF1(_L("Create camera using Camera::NewL() and MCameraObserver"));
sl@0
  2258
	TRAP(error, camera = CCamera::NewL(*observer, 0));
sl@0
  2259
	if (error==KErrNone)
sl@0
  2260
		{
sl@0
  2261
		CleanupStack::PushL(camera);
sl@0
  2262
		INFO_PRINTF1(_L("Create VideoCaptureControl from CCamera object"));
sl@0
  2263
		
sl@0
  2264
		TRAP(error, videoCapture  = CCamera::CCameraVideoCaptureControl::NewL(*camera, *videoCaptureObserver));	
sl@0
  2265
 		if (error==KErrExtensionNotSupported)
sl@0
  2266
	    	{
sl@0
  2267
	    	INFO_PRINTF1(_L("CCameraVideoCaptureControl object creation using old Observer failed with correct error"));
sl@0
  2268
	    	}
sl@0
  2269
	    else
sl@0
  2270
    		{
sl@0
  2271
    		INFO_PRINTF1(_L("CCameraVideoCaptureControl object creation using old Observer gave unexpected result"));
sl@0
  2272
    		result = EFail;
sl@0
  2273
    		}	
sl@0
  2274
		CleanupStack::PopAndDestroy(camera);
sl@0
  2275
		}
sl@0
  2276
	else 
sl@0
  2277
		{
sl@0
  2278
		INFO_PRINTF2(_L("Unexpected %d return from CCamera::NewL()"), error);
sl@0
  2279
		result = EFail;	
sl@0
  2280
		User::Leave(KErrNoMemory);	
sl@0
  2281
		}
sl@0
  2282
	__MM_HEAP_MARKEND;
sl@0
  2283
	
sl@0
  2284
	// using observer2 with NewL 
sl@0
  2285
	MCameraObserver2* observer2 = NULL;	
sl@0
  2286
	__MM_HEAP_MARK;
sl@0
  2287
	INFO_PRINTF1(_L("Create camera using Camera::NewL() and MCameraObserver2"));
sl@0
  2288
	TRAP(error, camera = CCamera::NewL(*observer2, 0,0));
sl@0
  2289
	if (error==KErrNone)
sl@0
  2290
		{
sl@0
  2291
		CleanupStack::PushL(camera);
sl@0
  2292
		INFO_PRINTF1(_L("Create VideoCaptureControl from CCamera object"));
sl@0
  2293
		
sl@0
  2294
		TRAP(error, videoCapture  = CCamera::CCameraVideoCaptureControl::NewL(*camera, *videoCaptureObserver));		
sl@0
  2295
 		if (error==KErrExtensionNotSupported)
sl@0
  2296
	    	{
sl@0
  2297
	    	INFO_PRINTF1(_L("CCameraVideoCaptureControl object creation using Observer2 with NewL failed with correct error"));
sl@0
  2298
	    	}
sl@0
  2299
	    else
sl@0
  2300
    		{
sl@0
  2301
    		INFO_PRINTF1(_L("CCameraVideoCaptureControl object creation using Observer2 with NewL gave unexpected result"));
sl@0
  2302
    		result = EFail;
sl@0
  2303
    		}	
sl@0
  2304
		CleanupStack::PopAndDestroy(camera);
sl@0
  2305
		}
sl@0
  2306
	else 
sl@0
  2307
		{
sl@0
  2308
		INFO_PRINTF2(_L("Unexpected %d return from CCamera::NewL()"), error);
sl@0
  2309
		result = EFail;	
sl@0
  2310
		User::Leave(KErrNoMemory);	
sl@0
  2311
		}
sl@0
  2312
	__MM_HEAP_MARKEND;
sl@0
  2313
	
sl@0
  2314
	
sl@0
  2315
	// create video capture control object using New2L
sl@0
  2316
	__MM_HEAP_MARK;
sl@0
  2317
	INFO_PRINTF1(_L("Create camera using Camera::New2L() and MCameraObserver2"));
sl@0
  2318
	
sl@0
  2319
	TRAP(error, camera = CCamera::New2L(*observer2, 0,0));
sl@0
  2320
	if (error==KErrNone)
sl@0
  2321
		{
sl@0
  2322
		CleanupStack::PushL(camera);
sl@0
  2323
		INFO_PRINTF1(_L("KErrNone return from CCamera::New2L()"));
sl@0
  2324
		TRAP(error, videoCapture = CCamera::CCameraVideoCaptureControl::NewL(*camera, *videoCaptureObserver));	
sl@0
  2325
		
sl@0
  2326
		if (error==KErrNone)
sl@0
  2327
	    	{
sl@0
  2328
	    	CleanupStack::PushL(videoCapture);
sl@0
  2329
	  		INFO_PRINTF1(_L("CCameraVideoCaptureControl object was created using NewL")); 
sl@0
  2330
	    	CleanupStack::PopAndDestroy(videoCapture);
sl@0
  2331
	    	}
sl@0
  2332
	    else
sl@0
  2333
    		{
sl@0
  2334
    		INFO_PRINTF1(_L("CCameraVideoCaptureControl object was not created using NewL")); 
sl@0
  2335
    		result = EFail;
sl@0
  2336
    		User::Leave(KErrNoMemory);
sl@0
  2337
    		}	
sl@0
  2338
		CleanupStack::PopAndDestroy(camera);
sl@0
  2339
		}
sl@0
  2340
	else 
sl@0
  2341
		{
sl@0
  2342
		INFO_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
sl@0
  2343
		result = EFail;
sl@0
  2344
		User::Leave(KErrNoMemory);		
sl@0
  2345
		}
sl@0
  2346
	__MM_HEAP_MARKEND;
sl@0
  2347
   
sl@0
  2348
	return result;
sl@0
  2349
	}
sl@0
  2350
	
sl@0
  2351
/*--------------------------------------------------------------
sl@0
  2352
 	Video Capture Control : RECamVideoCaptureNotificationTest
sl@0
  2353
 *--------------------------------------------------------------*/
sl@0
  2354
RECamVideoCaptureNotificationTest* RECamVideoCaptureNotificationTest::NewL(TBool aAllocTest)
sl@0
  2355
	{
sl@0
  2356
	RECamVideoCaptureNotificationTest* self = new (ELeave) RECamVideoCaptureNotificationTest(aAllocTest);
sl@0
  2357
	CleanupStack::PushL(self);
sl@0
  2358
	self->ConstructL();
sl@0
  2359
	CleanupStack::Pop(self);
sl@0
  2360
	return self;	
sl@0
  2361
	}
sl@0
  2362
	
sl@0
  2363
void RECamVideoCaptureNotificationTest::ConstructL()
sl@0
  2364
	{
sl@0
  2365
	}
sl@0
  2366
	
sl@0
  2367
RECamVideoCaptureNotificationTest::RECamVideoCaptureNotificationTest(TBool /*aAllocTest*/)
sl@0
  2368
	{
sl@0
  2369
	iTestStepName = _L("MM-ECM-ADV-U-057-HP");
sl@0
  2370
	}
sl@0
  2371
	
sl@0
  2372
void RECamVideoCaptureNotificationTest::VideoBufferReady(MCameraBuffer2* /*aVideoBuffer*/, TInt aErrorCode)
sl@0
  2373
	{
sl@0
  2374
	iError = aErrorCode;
sl@0
  2375
	}
sl@0
  2376
sl@0
  2377
void RECamVideoCaptureNotificationTest::ClientSnapshotReady(MCameraBuffer2* /*aSnapshotBuffer*/, TInt aErrorCode)
sl@0
  2378
	{
sl@0
  2379
	iError = aErrorCode;
sl@0
  2380
	}
sl@0
  2381
sl@0
  2382
void RECamVideoCaptureNotificationTest::ClientHistogramReady(MHistogramV2Buffer* /*aClientHistogramBuffer*/, TInt aErrorCode)
sl@0
  2383
	{
sl@0
  2384
	iError = aErrorCode;
sl@0
  2385
	}
sl@0
  2386
	
sl@0
  2387
void RECamVideoCaptureNotificationTest::ImageProcessingFailed(TInt aErrorCode)
sl@0
  2388
	{
sl@0
  2389
	iError = aErrorCode;	
sl@0
  2390
	}
sl@0
  2391
	
sl@0
  2392
void RECamVideoCaptureNotificationTest::DirectVideoCaptureFailed(TInt aErrorCode)
sl@0
  2393
	{
sl@0
  2394
	iError = aErrorCode;
sl@0
  2395
	}
sl@0
  2396
	
sl@0
  2397
TInt RECamVideoCaptureNotificationTest::CustomInterface(TUid /*aInterface*/, TAny*& /*aPtrInterface*/)
sl@0
  2398
	{
sl@0
  2399
	return KErrNone;
sl@0
  2400
	}
sl@0
  2401
sl@0
  2402
void RECamVideoCaptureNotificationTest::CheckVideoCaptureNegNotification(TInt aErrorCode, TVerdict& aResult)	
sl@0
  2403
	{
sl@0
  2404
	INFO_PRINTF3(_L("Expected Video Capture Control Error %d, received Error %d."), aErrorCode, iError); 
sl@0
  2405
	if (iError != aErrorCode)
sl@0
  2406
		{
sl@0
  2407
	    aResult = EFail;
sl@0
  2408
	    }
sl@0
  2409
	}
sl@0
  2410
	
sl@0
  2411
TVerdict RECamVideoCaptureNotificationTest::DoTestStepL()
sl@0
  2412
	{
sl@0
  2413
	TVerdict result = EPass;
sl@0
  2414
	CCamera* camera = NULL;
sl@0
  2415
	
sl@0
  2416
	TInt error = KErrNone;
sl@0
  2417
	CCamera::CCameraVideoCaptureControl* videocapture = NULL;
sl@0
  2418
	
sl@0
  2419
	// create video capture control object using New2L
sl@0
  2420
	__MM_HEAP_MARK;
sl@0
  2421
	INFO_PRINTF1(_L("Create camera using Camera::New2L() and MCameraObserver2"));
sl@0
  2422
	
sl@0
  2423
	TRAP(error, camera = CCamera::New2L(*this, 0, 0));
sl@0
  2424
sl@0
  2425
	if (error==KErrNone)
sl@0
  2426
		{
sl@0
  2427
		CleanupStack::PushL(camera);
sl@0
  2428
		INFO_PRINTF1(_L("KErrNone return from CCamera::New2L()"));
sl@0
  2429
		TRAP(error, videocapture  = CCamera::CCameraVideoCaptureControl::NewL(*camera, *this));	
sl@0
  2430
		
sl@0
  2431
		if (error==KErrNone)
sl@0
  2432
	    	{
sl@0
  2433
	    	CleanupStack::PushL(videocapture);
sl@0
  2434
	  		INFO_PRINTF1(_L("CCameraVideoCaptureControl object was created using NewL")); 
sl@0
  2435
	  		//Test Video Capture APIs
sl@0
  2436
	  		INFO_PRINTF1(_L("Create Histogram for Direct ViewFinder"));
sl@0
  2437
	  		CCamera::CCameraV2Histogram* histogram_VC = videocapture->CreateHistogramHandleL();
sl@0
  2438
	  		if(!histogram_VC)
sl@0
  2439
	  			{
sl@0
  2440
	  			INFO_PRINTF1(_L("Histogram creation for Video Capture Control unsuccessful"));
sl@0
  2441
	  			result = EFail;
sl@0
  2442
	  			}
sl@0
  2443
	  			
sl@0
  2444
	  		CleanupStack::PushL(histogram_VC);
sl@0
  2445
	  			
sl@0
  2446
	  		INFO_PRINTF1(_L("Create ImageProcessing for Video Capture Control "));
sl@0
  2447
	  		
sl@0
  2448
	  		TRAPD(err, videocapture->GetTransformationHandleL());
sl@0
  2449
  			if(err != KErrNotSupported)
sl@0
  2450
  				{
sl@0
  2451
  				INFO_PRINTF1(_L("ImageProcessing creation for Video Capture Control : unexpected result!"));
sl@0
  2452
  				result = EFail;
sl@0
  2453
  				}
sl@0
  2454
  				
sl@0
  2455
  			INFO_PRINTF1(_L("Create snapshot for Video Capture Control "));
sl@0
  2456
  			TInt viewfinderID=0;
sl@0
  2457
	  		CCamera::CCameraSnapshot* snapshot_VC = videocapture->GetSnapshotHandleL(viewfinderID);
sl@0
  2458
  			if(!snapshot_VC)
sl@0
  2459
  				{
sl@0
  2460
  				INFO_PRINTF1(_L("snapshot creation for Video Capture Control : unexpected result!"));
sl@0
  2461
  				result = EFail;
sl@0
  2462
  				}
sl@0
  2463
  			
sl@0
  2464
  			CleanupStack::PushL(snapshot_VC);
sl@0
  2465
	  		
sl@0
  2466
	  		//set properties for video capture
sl@0
  2467
	  		INFO_PRINTF1(_L("GetVideoFormatsSupportedL for Video Capture Control"));
sl@0
  2468
	  		TUint videoFormatsSupported=0;
sl@0
  2469
	  		TSize size(320,240);
sl@0
  2470
	  		TRAP(err,videocapture->GetVideoFormatsSupportedL(videoFormatsSupported, size));
sl@0
  2471
  			if(err != KErrNone)
sl@0
  2472
  				{
sl@0
  2473
  				INFO_PRINTF1(_L("GetVideoFormatsSupportedL for Video Capture Control: unexpected result!"));
sl@0
  2474
  				result = EFail;
sl@0
  2475
  				}
sl@0
  2476
	  		
sl@0
  2477
	  		if(videoFormatsSupported == 0)
sl@0
  2478
	  			{
sl@0
  2479
	  			INFO_PRINTF1(_L(" Number of VideoFormats Supported for Video Capture Control: unexpected result!"));
sl@0
  2480
	  			}
sl@0
  2481
	  		
sl@0
  2482
	  		INFO_PRINTF1(_L("GetPixelAspectsSupportedL for Video Capture Control"));
sl@0
  2483
	  		TUint pixelAspectsSupported=0;
sl@0
  2484
	  		CCamera::TFormat format = CCamera::EFormatFbsBitmapColor16M;
sl@0
  2485
	  		TRAP(err,videocapture->GetPixelAspectsSupportedL(pixelAspectsSupported, format, size));
sl@0
  2486
  			if(err != KErrNone)
sl@0
  2487
  				{
sl@0
  2488
  				INFO_PRINTF1(_L("GetPixelAspectsSupportedL for Video Capture Control: unexpected result!"));
sl@0
  2489
  				result = EFail;
sl@0
  2490
  				}
sl@0
  2491
	  		
sl@0
  2492
	  		if(pixelAspectsSupported == 0)
sl@0
  2493
	  			{
sl@0
  2494
	  			INFO_PRINTF1(_L(" Number of PixelAspects Supported for Video Capture Control: unexpected result!"));
sl@0
  2495
	  			}	
sl@0
  2496
	  			
sl@0
  2497
			INFO_PRINTF1(_L("GetEmbeddedStillCaptureSupportInfoL for Video Capture Control"));
sl@0
  2498
	  		TInt supportedEmbeddedStillCaptureTypes=0;
sl@0
  2499
	  		TRAP(err,videocapture->GetEmbeddedStillCaptureSupportInfoL(supportedEmbeddedStillCaptureTypes));
sl@0
  2500
  			if(err != KErrNone)
sl@0
  2501
  				{
sl@0
  2502
  				INFO_PRINTF1(_L("GetEmbeddedStillCaptureSupportInfoL for Video Capture Control: unexpected result!"));
sl@0
  2503
  				result = EFail;
sl@0
  2504
  				}
sl@0
  2505
	  		
sl@0
  2506
	  		if(supportedEmbeddedStillCaptureTypes != 0)
sl@0
  2507
	  			{
sl@0
  2508
	  			INFO_PRINTF1(_L(" Supported Types of Embedded Still Capture for Video Capture Control: unexpected result!"));
sl@0
  2509
	  			}	
sl@0
  2510
	  			
sl@0
  2511
			INFO_PRINTF1(_L("PrepareVideoCapture for Video Capture Control"));
sl@0
  2512
			iInputEventUid = KUidECamEventVideoCaptureControlPrepareComplete;
sl@0
  2513
			CCamera::CCameraVideoCaptureControl::TPrepareVideoParameters prepareVideoParameters;
sl@0
  2514
			
sl@0
  2515
			prepareVideoParameters.SetEmbeddedStillCaptureState(ETrue);
sl@0
  2516
			
sl@0
  2517
			if(!prepareVideoParameters.IsEmbeddedStillCaptureEnabled())
sl@0
  2518
				{
sl@0
  2519
				INFO_PRINTF1(_L("IsEmbeddedStillCaptureEnabled for Video Capture Control: unexpected result!"));
sl@0
  2520
  				result = EFail;
sl@0
  2521
				}
sl@0
  2522
				
sl@0
  2523
			prepareVideoParameters.SetEmbeddedStillCaptureState(EFalse);
sl@0
  2524
			
sl@0
  2525
			if(prepareVideoParameters.IsEmbeddedStillCaptureEnabled() != EFalse)
sl@0
  2526
				{
sl@0
  2527
				INFO_PRINTF1(_L("IsEmbeddedStillCaptureEnabled for Video Capture Control: unexpected result!"));
sl@0
  2528
  				result = EFail;
sl@0
  2529
				}
sl@0
  2530
			
sl@0
  2531
	  		videocapture->PrepareVideoCapture(prepareVideoParameters);
sl@0
  2532
	  		
sl@0
  2533
	  		CheckNotification(iInputEventUid, result);	
sl@0
  2534
	
sl@0
  2535
    		INFO_PRINTF1(_L("GetRangeAffectedSettingsL for Video Capture Control"));
sl@0
  2536
			RArray<TUid> affectedSettings;
sl@0
  2537
			
sl@0
  2538
			TRAP(err,videocapture->GetRangeAffectedSettingsL(affectedSettings));
sl@0
  2539
			if(err != KErrNone)
sl@0
  2540
				{
sl@0
  2541
				INFO_PRINTF1(_L("GetRangeAffectedSettingsL for Video Capture Control: unexpected result!"));
sl@0
  2542
  				result = EFail;
sl@0
  2543
				}
sl@0
  2544
				
sl@0
  2545
			if(affectedSettings.Count() != 0)
sl@0
  2546
				{
sl@0
  2547
				INFO_PRINTF1(_L("Number of RangeAffectedSettingsL for Video Capture Control: unexpected result!"));
sl@0
  2548
				result = EFail;
sl@0
  2549
				}
sl@0
  2550
				
sl@0
  2551
			INFO_PRINTF1(_L("GetValueAffectedSettingsL for Video Capture Control"));
sl@0
  2552
			TRAP(err,videocapture->GetValueAffectedSettingsL(affectedSettings));
sl@0
  2553
			if(err != KErrNone)
sl@0
  2554
				{
sl@0
  2555
				INFO_PRINTF1(_L("GetValueAffectedSettingsL for Video Capture Control: unexpected result!"));
sl@0
  2556
  				result = EFail;
sl@0
  2557
				}
sl@0
  2558
				
sl@0
  2559
			if(affectedSettings.Count() != 0)
sl@0
  2560
				{
sl@0
  2561
				INFO_PRINTF1(_L("Number of ValueAffectedSettingsL for Video Capture Control: unexpected result!"));
sl@0
  2562
				result = EFail;
sl@0
  2563
				}
sl@0
  2564
				
sl@0
  2565
			INFO_PRINTF1(_L("GetDisabledSettingsL for Video Capture Control"));
sl@0
  2566
			TRAP(err,videocapture->GetDisabledSettingsL(affectedSettings));
sl@0
  2567
			if(err != KErrNone)
sl@0
  2568
				{
sl@0
  2569
				INFO_PRINTF1(_L("GetDisabledSettingsL for Video Capture Control: unexpected result!"));
sl@0
  2570
  				result = EFail;
sl@0
  2571
				}
sl@0
  2572
				
sl@0
  2573
			if(affectedSettings.Count() != 0)
sl@0
  2574
				{
sl@0
  2575
				INFO_PRINTF1(_L("Number of DisabledSettingsL for Video Capture Control: unexpected result!"));
sl@0
  2576
				result = EFail;
sl@0
  2577
				}
sl@0
  2578
				
sl@0
  2579
			INFO_PRINTF1(_L("ReleaseVideoResource for Video Capture Control"));
sl@0
  2580
			videocapture->ReleaseVideoResource();
sl@0
  2581
			
sl@0
  2582
			INFO_PRINTF1(_L("GetFadingEffectStateL for Video Capture Control"));
sl@0
  2583
			CCamera::CCameraVideoCaptureControl::TFadingEffectState fadingEffectState = 
sl@0
  2584
																CCamera::CCameraVideoCaptureControl::EFadingEffectDisabled;
sl@0
  2585
			TRAP(err,videocapture->GetFadingEffectStateL(fadingEffectState));
sl@0
  2586
			if(err != KErrNotSupported)
sl@0
  2587
				{
sl@0
  2588
				INFO_PRINTF1(_L("GetFadingEffectStateL for Video Capture Control: unexpected result!"));
sl@0
  2589
  				result = EFail;
sl@0
  2590
				}
sl@0
  2591
			
sl@0
  2592
			INFO_PRINTF1(_L("SetFadingEffectState for Video Capture Control"));
sl@0
  2593
			iInputEventUid = KUidECamEventVideoCaptureControlFadingEffect;
sl@0
  2594
			videocapture->SetFadingEffectState(CCamera::CCameraVideoCaptureControl::EFadingEffectEnabled);
sl@0
  2595
			CheckNotificationNeg(iInputEventUid, result);
sl@0
  2596
			
sl@0
  2597
    		//set properties for histogram (for video capture)
sl@0
  2598
	  		TUint supportedHistogramType=0;
sl@0
  2599
	  		histogram_VC->GetSupportedHistogramsL(supportedHistogramType);
sl@0
  2600
	  		if(supportedHistogramType!=0)
sl@0
  2601
	  			{
sl@0
  2602
	  			INFO_PRINTF1(_L("unexpected GetSupportedHistogramsL"));
sl@0
  2603
	  			result = EFail;
sl@0
  2604
	  			}
sl@0
  2605
	  			
sl@0
  2606
	  		INFO_PRINTF1(_L("GetDirectHistogramSupportInfoL for Histogram for Video Capture"));
sl@0
  2607
	  		TBool directHistogramSupported = EFalse;
sl@0
  2608
	  		TRAP(err,histogram_VC->GetDirectHistogramSupportInfoL(directHistogramSupported));
sl@0
  2609
  			if(err != KErrNotSupported)
sl@0
  2610
  				{
sl@0
  2611
  				INFO_PRINTF1(_L("GetDirectHistogramSupportInfoL for Histogram for Video Capture: unexpected result!"));
sl@0
  2612
  				result = EFail;
sl@0
  2613
  				}
sl@0
  2614
	  			
sl@0
  2615
	  		INFO_PRINTF1(_L("PrepareClientHistogramL for Histogram for Video Capture"));
sl@0
  2616
	  		CCamera::CCameraV2Histogram::THistogramType histogramType = CCamera::CCameraV2Histogram::EHistNone;
sl@0
  2617
	  		TRAP(err,histogram_VC->PrepareClientHistogramL(histogramType));
sl@0
  2618
  			if(err != KErrNotSupported)
sl@0
  2619
  				{
sl@0
  2620
  				INFO_PRINTF1(_L("PrepareClientHistogramL for Histogram for Video Capture: unexpected result!"));
sl@0
  2621
  				result = EFail;
sl@0
  2622
  				}
sl@0
  2623
	  		
sl@0
  2624
	  		INFO_PRINTF1(_L("PrepareDirectHistogramL for Histogram for Video Capture"));
sl@0
  2625
	  		CCamera::CCameraV2Histogram::TDirectHistogramParameters histogramParameters;
sl@0
  2626
	  		TRAP(err,histogram_VC->PrepareDirectHistogramL(histogramParameters));
sl@0
  2627
  			if(err != KErrNotSupported)
sl@0
  2628
  				{
sl@0
  2629
  				INFO_PRINTF1(_L("PrepareDirectHistogramL for Histogram for Video Capture: unexpected result!"));
sl@0
  2630
  				result = EFail;
sl@0
  2631
  				}
sl@0
  2632
	  			
sl@0
  2633
	  		INFO_PRINTF1(_L("UpdateDirectHistogramPropertiesL for Histogram for Video Capture"));
sl@0
  2634
	   		TRAP(err,histogram_VC->UpdateDirectHistogramPropertiesL(histogramParameters));
sl@0
  2635
  			if(err != KErrNotSupported)
sl@0
  2636
  				{
sl@0
  2637
  				INFO_PRINTF1(_L("UpdateDirectHistogramPropertiesL for Histogram for Video Capture: unexpected result!"));
sl@0
  2638
  				result = EFail;
sl@0
  2639
  				}
sl@0
  2640
	  			
sl@0
  2641
	  		INFO_PRINTF1(_L("GetDirectHistogramPropertiesL for Histogram for Video Capture"));
sl@0
  2642
	   		TRAP(err,histogram_VC->GetDirectHistogramPropertiesL(histogramParameters));
sl@0
  2643
  			if(err != KErrNotSupported)
sl@0
  2644
  				{
sl@0
  2645
  				INFO_PRINTF1(_L("GetDirectHistogramPropertiesL for Histogram for Video Capture: unexpected result!"));
sl@0
  2646
  				result = EFail;
sl@0
  2647
  				}
sl@0
  2648
	  			
sl@0
  2649
			INFO_PRINTF1(_L("GetHistogramStateL for Histogram for Video Capture"));
sl@0
  2650
	   		TBool histogramActive = EFalse;
sl@0
  2651
	   		TRAP(err,histogram_VC->GetHistogramStateL(histogramActive));
sl@0
  2652
  			if(err != KErrNotSupported)
sl@0
  2653
  				{
sl@0
  2654
  				INFO_PRINTF1(_L("GetHistogramStateL for Histogram for Video Capture: unexpected result!"));
sl@0
  2655
  				result = EFail;
sl@0
  2656
  				}
sl@0
  2657
			
sl@0
  2658
			//set properties for snapshot (for video capture)
sl@0
  2659
			CCamera::CCameraSnapshot::TSnapshotParameters snapshotParam;
sl@0
  2660
			
sl@0
  2661
			INFO_PRINTF1(_L("SetAspectRatioState for Snapshot for Video Capture"));
sl@0
  2662
			snapshotParam.SetAspectRatioState(ETrue);
sl@0
  2663
			TBool aspectRatioState = snapshotParam.IsAspectRatioMaintained();
sl@0
  2664
			if(!aspectRatioState)
sl@0
  2665
				{
sl@0
  2666
				INFO_PRINTF1(_L("AspectRatioState for Snapshot for Video Capture: unexpected result!"));
sl@0
  2667
  				result = EFail;
sl@0
  2668
				}
sl@0
  2669
			snapshotParam.SetAspectRatioState(EFalse);
sl@0
  2670
			aspectRatioState = snapshotParam.IsAspectRatioMaintained();
sl@0
  2671
			if(aspectRatioState != EFalse)
sl@0
  2672
				{
sl@0
  2673
				INFO_PRINTF1(_L("AspectRatioState for Snapshot for Video Capture: unexpected result!"));
sl@0
  2674
  				result = EFail;
sl@0
  2675
				}
sl@0
  2676
			
sl@0
  2677
			INFO_PRINTF1(_L("PrepareSnapshotL for Snapshot for Video Capture"));
sl@0
  2678
			TRAP(err,snapshot_VC->PrepareSnapshotL(snapshotParam));
sl@0
  2679
	   		if(err != KErrNone)
sl@0
  2680
	   			{
sl@0
  2681
	   			INFO_PRINTF1(_L("PrepareSnapshotL for Snapshot for Video Capture: unexpected result!"));
sl@0
  2682
  				result = EFail;
sl@0
  2683
	   			}
sl@0
  2684
	   			
sl@0
  2685
	   		INFO_PRINTF1(_L("GetSnapshotParametersL for Snapshot for Video Capture"));
sl@0
  2686
			TRAP(err,snapshot_VC->GetSnapshotParametersL(snapshotParam));
sl@0
  2687
	   		if(err != KErrNone)
sl@0
  2688
	   			{
sl@0
  2689
	   			INFO_PRINTF1(_L("GetSnapshotParametersL for Snapshot for Video Capture: unexpected result!"));
sl@0
  2690
  				result = EFail;
sl@0
  2691
	   			}
sl@0
  2692
	   		
sl@0
  2693
	   		INFO_PRINTF1(_L("SetSnapshotParametersL for Snapshot for Video Capture"));
sl@0
  2694
			TRAP(err,snapshot_VC->SetSnapshotParametersL(snapshotParam));
sl@0
  2695
	   		if(err != KErrNone)
sl@0
  2696
	   			{
sl@0
  2697
	   			INFO_PRINTF1(_L("SetSnapshotParametersL for Snapshot for Video Capture: unexpected result!"));
sl@0
  2698
  				result = EFail;
sl@0
  2699
	   			}
sl@0
  2700
	   				
sl@0
  2701
			INFO_PRINTF1(_L("SelectSnapshotVideoFramesL for Snapshot for Video Capture"));
sl@0
  2702
			CCamera::CCameraSnapshot::TSnapshotVideoFrames snapshotVideoFrames = CCamera::CCameraSnapshot::ESnapshotVideoFirstFrame;
sl@0
  2703
			TRAP(err,snapshot_VC->SelectSnapshotVideoFramesL(snapshotVideoFrames));
sl@0
  2704
	   		if(err != KErrNotSupported)
sl@0
  2705
	   			{
sl@0
  2706
	   			INFO_PRINTF1(_L("SelectSnapshotVideoFramesL for Snapshot for Video Capture: unexpected result!"));
sl@0
  2707
  				result = EFail;
sl@0
  2708
	   			}
sl@0
  2709
	   			
sl@0
  2710
			//Start video capture and other child objects
sl@0
  2711
			INFO_PRINTF1(_L("StartVideoCaptureL for Video Capture"));
sl@0
  2712
			TRAP(err,videocapture->StartVideoCaptureL());
sl@0
  2713
			if(err != KErrNone)
sl@0
  2714
				{
sl@0
  2715
	   			INFO_PRINTF1(_L("StartVideoCaptureL for Video Capture: unexpected result!"));
sl@0
  2716
  				result = EFail;
sl@0
  2717
	   			}
sl@0
  2718
	   			
sl@0
  2719
	   		CheckVideoCaptureNegNotification(KErrNotSupported, result);
sl@0
  2720
	   		
sl@0
  2721
	   		INFO_PRINTF1(_L("StartHistogram for Video Capture"));
sl@0
  2722
			histogram_VC->StartHistogram();
sl@0
  2723
			CheckVideoCaptureNegNotification(KErrNotSupported, result);
sl@0
  2724
	  		
sl@0
  2725
	  		INFO_PRINTF1(_L("StopHistogram for Video Capture"));	
sl@0
  2726
			histogram_VC->StopHistogram();
sl@0
  2727
			
sl@0
  2728
			INFO_PRINTF1(_L("EnableSnapshotL for snapshot for Video Capture"));	
sl@0
  2729
			TRAP(err,snapshot_VC->EnableSnapshotL());
sl@0
  2730
			if(err != KErrNone)
sl@0
  2731
				{
sl@0
  2732
	   			INFO_PRINTF1(_L("EnableSnapshotL for snapshot for Video Capture: unexpected result!"));
sl@0
  2733
  				result = EFail;
sl@0
  2734
	   			}
sl@0
  2735
	   		CheckVideoCaptureNegNotification(KErrNotSupported, result);
sl@0
  2736
	   		
sl@0
  2737
			INFO_PRINTF1(_L("GetSnapshotStatusL for snapshot for Video Capture"));	
sl@0
  2738
			CCamera::CCameraSnapshot::TSnapshotState snapshotState = CCamera::CCameraSnapshot::ESnapshotInactive;
sl@0
  2739
			TRAP(err,snapshot_VC->GetSnapshotStatusL(snapshotState));
sl@0
  2740
			if(err != KErrNotSupported)
sl@0
  2741
				{
sl@0
  2742
	   			INFO_PRINTF1(_L("GetSnapshotStatusL for snapshot for Video Capture: unexpected result!"));
sl@0
  2743
  				result = EFail;
sl@0
  2744
	   			}
sl@0
  2745
	   			
sl@0
  2746
	   		INFO_PRINTF1(_L("DisableSnapshotL for snapshot for Video Capture"));	
sl@0
  2747
			TRAP(err,snapshot_VC->DisableSnapshotL());
sl@0
  2748
			if(err != KErrNone)
sl@0
  2749
				{
sl@0
  2750
	   			INFO_PRINTF1(_L("DisableSnapshotL for snapshot for Video Capture: unexpected result!"));
sl@0
  2751
  				result = EFail;
sl@0
  2752
	   			}
sl@0
  2753
	   			
sl@0
  2754
	   		INFO_PRINTF1(_L("PauseVideoCapture for Video Capture"));
sl@0
  2755
	   		videocapture->PauseVideoCapture();
sl@0
  2756
	   			
sl@0
  2757
	   		INFO_PRINTF1(_L("ResumeVideoCaptureL for Video Capture"));
sl@0
  2758
			TRAP(err,videocapture->ResumeVideoCaptureL());
sl@0
  2759
			if(err != KErrNotSupported)
sl@0
  2760
				{
sl@0
  2761
	   			INFO_PRINTF1(_L("ResumeVideoCaptureL for Video Capture: unexpected result!"));
sl@0
  2762
  				result = EFail;
sl@0
  2763
	   			}
sl@0
  2764
	   			
sl@0
  2765
	   		INFO_PRINTF1(_L("GetVideoCaptureStateL for Video Capture"));
sl@0
  2766
	   		CCamera::CCameraVideoCaptureControl::TVideoCaptureState videoCaptureState = 
sl@0
  2767
	   				CCamera::CCameraVideoCaptureControl::EVideoCaptureInActive;
sl@0
  2768
			TRAP(err,videocapture->GetVideoCaptureStateL(videoCaptureState));
sl@0
  2769
			if(err != KErrNotSupported)
sl@0
  2770
				{
sl@0
  2771
	   			INFO_PRINTF1(_L("GetVideoCaptureStateL for Video Capture: unexpected result!"));
sl@0
  2772
  				result = EFail;
sl@0
  2773
	   			}
sl@0
  2774
	   			
sl@0
  2775
	   		INFO_PRINTF1(_L("StopVideoCapture for Video Capture"));
sl@0
  2776
	   		videocapture->StopVideoCapture();
sl@0
  2777
	   			   		
sl@0
  2778
	   		//Start Direct video capture and other child objects
sl@0
  2779
	   		TInt supportedDVCType = -1;
sl@0
  2780
	   		INFO_PRINTF1(_L("Check Direct Video Capture Support Info"));
sl@0
  2781
	   		TRAP(err,videocapture->GetVideoCaptureSupportInfoL(supportedDVCType));
sl@0
  2782
			if(err != KErrNone)
sl@0
  2783
				{
sl@0
  2784
	   			INFO_PRINTF1(_L("GetVideoCaptureSupportInfoL for Video Capture: unexpected result!"));
sl@0
  2785
  				result = EFail;
sl@0
  2786
	   			}
sl@0
  2787
	   			
sl@0
  2788
	   		if(supportedDVCType != KSupportedDirectVCType)
sl@0
  2789
	   			{
sl@0
  2790
	   			INFO_PRINTF1(_L("GetVideoCaptureSupportInfoL for Video Capture: unexpected result!"));
sl@0
  2791
  				result = EFail;
sl@0
  2792
	   			}
sl@0
  2793
sl@0
  2794
			INFO_PRINTF1(_L("Test Set Client Video Capture in PrepareVideoParameters"));
sl@0
  2795
	   		
sl@0
  2796
	   		prepareVideoParameters.SetVideoCaptureType(CCamera::CCameraVideoCaptureControl::EClientVideoCapture);
sl@0
  2797
			
sl@0
  2798
			if(CCamera::CCameraVideoCaptureControl::EClientVideoCapture != prepareVideoParameters.VideoCaptureType())
sl@0
  2799
				{
sl@0
  2800
				INFO_PRINTF1(_L("iVideoCaptureType for TPrepareVideoParameters: unexpected result!"));
sl@0
  2801
  				result = EFail;
sl@0
  2802
				}
sl@0
  2803
	   		
sl@0
  2804
	   		
sl@0
  2805
			INFO_PRINTF1(_L("Set Video Capture in PrepareVideoParameters"));
sl@0
  2806
			
sl@0
  2807
			prepareVideoParameters.SetVideoCaptureType(CCamera::CCameraVideoCaptureControl::EDirectVideoCapture);
sl@0
  2808
			
sl@0
  2809
			if(CCamera::CCameraVideoCaptureControl::EDirectVideoCapture != prepareVideoParameters.VideoCaptureType())
sl@0
  2810
				{
sl@0
  2811
				INFO_PRINTF1(_L("iVideoCaptureType for TPrepareVideoParameters: unexpected result!"));
sl@0
  2812
  				result = EFail;
sl@0
  2813
				}
sl@0
  2814
				
sl@0
  2815
			prepareVideoParameters.iFormat = CCamera::EFormatEncodedH264;
sl@0
  2816
			prepareVideoParameters.iPixelAspectRatio = CCamera::CCameraAdvancedSettings::EEPixelAspect40To33;
sl@0
  2817
			
sl@0
  2818
			iInputEventUid = KUidECamEventVideoCaptureControlPrepareComplete;
sl@0
  2819
			videocapture->PrepareVideoCapture(prepareVideoParameters);
sl@0
  2820
	  		CheckNotification(iInputEventUid, result);
sl@0
  2821
						
sl@0
  2822
			INFO_PRINTF1(_L("StartVideoCaptureL for Direct Video Capture"));
sl@0
  2823
			TRAP(err,videocapture->StartVideoCaptureL());
sl@0
  2824
			if(err != KErrNone)
sl@0
  2825
				{
sl@0
  2826
	   			INFO_PRINTF1(_L("StartVideoCaptureL for Video Capture: unexpected result!"));
sl@0
  2827
  				result = EFail;
sl@0
  2828
	   			}
sl@0
  2829
	   			
sl@0
  2830
	   		CheckVideoCaptureNegNotification(KErrNotSupported, result);
sl@0
  2831
	   		
sl@0
  2832
	   		INFO_PRINTF1(_L("StopVideoCapture for Direct Video Capture"));
sl@0
  2833
	   		videocapture->StopVideoCapture();
sl@0
  2834
	   		
sl@0
  2835
	   		INFO_PRINTF1(_L("GetPrepareVideoParameters for Direct Video Capture"));
sl@0
  2836
	   		CCamera::CCameraVideoCaptureControl::TPrepareVideoParameters retrievedVideoParam;
sl@0
  2837
			TRAP(err,videocapture->GetPrepareVideoParametersL(retrievedVideoParam));
sl@0
  2838
			if(err != KErrNone)
sl@0
  2839
				{
sl@0
  2840
	   			INFO_PRINTF1(_L("GetPrepareVideoParametersL for Video Capture: unexpected result!"));
sl@0
  2841
  				result = EFail;
sl@0
  2842
	   			}
sl@0
  2843
	   			
sl@0
  2844
	   		if(CCamera::EFormatEncodedH264 != retrievedVideoParam.iFormat)
sl@0
  2845
				{
sl@0
  2846
	   			INFO_PRINTF1(_L("GetPrepareVideoParametersL for Video Capture: unexpected result!"));
sl@0
  2847
  				result = EFail;
sl@0
  2848
	   			}
sl@0
  2849
	   			
sl@0
  2850
	   		INFO_PRINTF2(_L("retrievedVideoParam.iFormat: %d"),retrievedVideoParam.iFormat);
sl@0
  2851
	   		INFO_PRINTF2(_L("retrievedVideoParam.iPixelAspectRatio: %d"),retrievedVideoParam.iPixelAspectRatio);
sl@0
  2852
	   		
sl@0
  2853
	   					
sl@0
  2854
			CleanupStack::PopAndDestroy(snapshot_VC);
sl@0
  2855
			CleanupStack::PopAndDestroy(histogram_VC);
sl@0
  2856
			CleanupStack::PopAndDestroy(videocapture);
sl@0
  2857
	    	}
sl@0
  2858
	    else
sl@0
  2859
    		{
sl@0
  2860
    		INFO_PRINTF1(_L("CCameraVideoCaptureControl object not created")); 
sl@0
  2861
    		result = EFail;
sl@0
  2862
    		}	
sl@0
  2863
		CleanupStack::PopAndDestroy(camera);
sl@0
  2864
		}
sl@0
  2865
	else 
sl@0
  2866
		{
sl@0
  2867
		INFO_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
sl@0
  2868
		result = EFail;		
sl@0
  2869
		}
sl@0
  2870
	__MM_HEAP_MARKEND;
sl@0
  2871
   
sl@0
  2872
	return result;
sl@0
  2873
	}