os/mm/imagingandcamerafws/cameraunittest/src/TSU_ECM_ADV/ECamAdvSetTest.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
sl@0
     2
// ECamAdvSetTest.cpp
sl@0
     3
sl@0
     4
// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     5
// All rights reserved.
sl@0
     6
// This component and the accompanying materials are made available
sl@0
     7
// under the terms of "Eclipse Public License v1.0"
sl@0
     8
// which accompanies this distribution, and is available
sl@0
     9
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
    10
//
sl@0
    11
// Initial Contributors:
sl@0
    12
// Nokia Corporation - initial contribution.
sl@0
    13
//
sl@0
    14
// Contributors:
sl@0
    15
//
sl@0
    16
// Description:
sl@0
    17
//
sl@0
    18
sl@0
    19
#include <fbs.h>
sl@0
    20
sl@0
    21
#include <ecamuids.hrh>
sl@0
    22
#include "ECamUnitTestPluginUids.hrh"
sl@0
    23
#include "ECamAdvSetTest.h"
sl@0
    24
#include <ecam/ecamplugin.h>
sl@0
    25
sl@0
    26
#include <ecom/ecomresolverparams.h>
sl@0
    27
#include "ECamUnitTestPlugin.h"
sl@0
    28
#include "AdvancedSettings.h"
sl@0
    29
#include <ecam/cameraoverlay.h>
sl@0
    30
#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
sl@0
    31
#include <ecamconst.h>
sl@0
    32
#include <ecamadvsettingsconst.h>
sl@0
    33
#endif
sl@0
    34
sl@0
    35
const TInt KShutterSpeed = 20;
sl@0
    36
const TInt KIsoRate01  	= 320;
sl@0
    37
const TInt KIsoRate0   	= 150;
sl@0
    38
const TInt KValue       = 100;
sl@0
    39
const TInt KContinuousAutoFocusTimeoutValue1 = 10000;
sl@0
    40
//const TRgb KRgbConst = TRgb(100,124,130);
sl@0
    41
const TInt KWBColorTemperature1       = 4300;
sl@0
    42
const TInt KDefaultIsoRating    	  = 200;
sl@0
    43
const TInt KDefaultAperture					= 280;
sl@0
    44
const TInt KAllPreCaptureWarnings			= 0x3FFF;
sl@0
    45
const TInt KBaselinedFocusRanges 			= 0x1F;
sl@0
    46
const TInt KBaselinedWhiteBalanceModes 		= 0x01FF;
sl@0
    47
const TInt KFlashCompensationStep			= 2;
sl@0
    48
const TInt KFlashCompensationInSteps		= 1;
sl@0
    49
const TInt KExposureCompensationStep		= 3;
sl@0
    50
const TInt KExposureCompensationInSteps		= 2;
sl@0
    51
const TInt KAutoISOTypes					=0x1E;
sl@0
    52
/*
sl@0
    53
const TInt KDefaultValue					= 0;
sl@0
    54
const TInt KContinuousAutoFocusTimeoutValue = 20000;
sl@0
    55
const TInt KBrightnessAdjMinValue			= -50;
sl@0
    56
const TInt KBrightnessAdjMaxValue			= 50;
sl@0
    57
sl@0
    58
const TInt KMaxIsoRate						= 200;
sl@0
    59
const TInt KMinIsoRate						= 0;
sl@0
    60
const TInt KDefaultShutterSpeed				= 0;
sl@0
    61
const TInt KDefaultFocusDistance			= 0;
sl@0
    62
sl@0
    63
const TInt KBracketStartIndex				= 0;
sl@0
    64
const TInt KBracketFrames					= 2;
sl@0
    65
const TBool KDefaultRedEyeReduce			= EFalse;
sl@0
    66
sl@0
    67
const TBool KExternalFlashPresentState		= EFalse;
sl@0
    68
const TInt KManualFlashPowerLevel			= 0;
sl@0
    69
const TBool KApertureExposureLockOn         = EFalse;
sl@0
    70
const TBool KShootClickOn					= EFalse;
sl@0
    71
const TInt KTimerInterval					= 0;
sl@0
    72
const TInt KBurstImages						= 0;
sl@0
    73
const TBool KExposureLockOn         		= EFalse;
sl@0
    74
const TBool KAutoFocusLockOn         		= EFalse;
sl@0
    75
const TBool KAutomaticSizeSelectionChangeOn	= EFalse;
sl@0
    76
const TInt KWBColorTemperature				= 6000;
sl@0
    77
*/
sl@0
    78
//
sl@0
    79
// RECamAdvSetTest
sl@0
    80
//
sl@0
    81
RECamAdvSetTest* RECamAdvSetTest::NewL(TBool aAllocTest)
sl@0
    82
	{
sl@0
    83
	RECamAdvSetTest* self = new (ELeave) RECamAdvSetTest(aAllocTest);
sl@0
    84
	return self;	
sl@0
    85
	}
sl@0
    86
	
sl@0
    87
RECamAdvSetTest::RECamAdvSetTest(TBool /*aAllocTest*/)
sl@0
    88
	{
sl@0
    89
	iTestStepName = _L("MM-ECM-ADV-U-005-HP");
sl@0
    90
	}
sl@0
    91
	
sl@0
    92
TVerdict RECamAdvSetTest::DoTestStepL()	
sl@0
    93
	{
sl@0
    94
	TVerdict verdict = EFail;
sl@0
    95
	INFO_PRINTF1(_L("Alloc test"));
sl@0
    96
	TInt i;
sl@0
    97
	TInt err;
sl@0
    98
	for (i = 1 ; ; i++)
sl@0
    99
		{
sl@0
   100
		__MM_HEAP_MARK;
sl@0
   101
		
sl@0
   102
		if (i % 5 == 0)
sl@0
   103
			{
sl@0
   104
			INFO_PRINTF2(_L("Fail count = %d"), i);
sl@0
   105
			}
sl@0
   106
sl@0
   107
		__UHEAP_SETFAIL(RHeap::EFailNext, i);
sl@0
   108
sl@0
   109
		TRAP(err, verdict = DoAdvTestStepL());
sl@0
   110
sl@0
   111
		TAny* testAlloc = User::Alloc(1);
sl@0
   112
		TBool heapTestingComplete = (testAlloc == NULL) && (err==KErrNone);
sl@0
   113
		User::Free(testAlloc);
sl@0
   114
sl@0
   115
		__UHEAP_RESET;
sl@0
   116
		__MM_HEAP_MARKEND;
sl@0
   117
sl@0
   118
		if ((err != KErrNoMemory ) || heapTestingComplete)
sl@0
   119
			{
sl@0
   120
			INFO_PRINTF4(_L("err = %d, verdict = %d, Fail count = %d"), err, verdict, i);
sl@0
   121
			INFO_PRINTF1(_L("Alloc testing completed successfully"));
sl@0
   122
			verdict = EPass;
sl@0
   123
			break;
sl@0
   124
			}
sl@0
   125
		}
sl@0
   126
	return verdict;
sl@0
   127
	}
sl@0
   128
	
sl@0
   129
TVerdict RECamAdvSetTest::DoAdvTestStepL()
sl@0
   130
	{	
sl@0
   131
	TVerdict result = EPass;
sl@0
   132
	CCamera* camera = NULL;
sl@0
   133
sl@0
   134
	TInt error = KErrNone;
sl@0
   135
	CCamera::CCameraAdvancedSettings* settings = NULL;
sl@0
   136
		
sl@0
   137
	// using observer 2 if exist 
sl@0
   138
	MCameraObserver2* observer2 = NULL;
sl@0
   139
	
sl@0
   140
	__MM_HEAP_MARK;
sl@0
   141
	INFO_PRINTF1(_L("Create camera using Camera::New2L() and MCameraObserver2"));
sl@0
   142
	TRAP(error, camera = CCamera::New2L(*observer2, 0,0));
sl@0
   143
	if (error==KErrNone)
sl@0
   144
		{
sl@0
   145
		CleanupStack::PushL(camera);
sl@0
   146
		INFO_PRINTF1(_L("Create advanced settings from CCamera object"));
sl@0
   147
		settings = 	static_cast<CCamera::CCameraAdvancedSettings*> (camera->CustomInterface(KECamAdvancedSettingUid));
sl@0
   148
	    if (settings!= NULL)
sl@0
   149
	    	{
sl@0
   150
	    	CleanupStack::PushL(settings);
sl@0
   151
	    	INFO_PRINTF1(_L("CCameraAdvancedSettings object was created")); 
sl@0
   152
	    	CleanupStack::PopAndDestroy(settings);
sl@0
   153
	    	}
sl@0
   154
	    else
sl@0
   155
    		{
sl@0
   156
    		result = EFail;
sl@0
   157
    		User::Leave(KErrNoMemory);
sl@0
   158
    		}	
sl@0
   159
		CleanupStack::PopAndDestroy(camera);
sl@0
   160
		}
sl@0
   161
	else 
sl@0
   162
		{
sl@0
   163
		INFO_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
sl@0
   164
		result = EFail;	
sl@0
   165
		User::Leave(KErrNoMemory);	
sl@0
   166
		}
sl@0
   167
	__MM_HEAP_MARKEND;
sl@0
   168
	
sl@0
   169
	// create a settings object using New2L
sl@0
   170
	__MM_HEAP_MARK;
sl@0
   171
	INFO_PRINTF1(_L("Create camera using Camera::New2L() and MCameraObserver2"));
sl@0
   172
	
sl@0
   173
	TRAP(error, camera = CCamera::New2L(*observer2, 0,0));
sl@0
   174
sl@0
   175
	if (error==KErrNone)
sl@0
   176
		{
sl@0
   177
		CleanupStack::PushL(camera);
sl@0
   178
		INFO_PRINTF1(_L("KErrNone return from CCamera::New2L()"));
sl@0
   179
		TRAP(error, settings  = CCamera::CCameraAdvancedSettings::NewL(*camera));	
sl@0
   180
		if (error==KErrNone)
sl@0
   181
	    	{
sl@0
   182
	    	CleanupStack::PushL(settings);
sl@0
   183
	  		INFO_PRINTF1(_L("CCameraAdvancedSettings object was created using NewL")); 
sl@0
   184
	    	CleanupStack::PopAndDestroy(settings);
sl@0
   185
	    	}
sl@0
   186
	    else
sl@0
   187
    		{
sl@0
   188
    		INFO_PRINTF1(_L("CCameraAdvancedSettings object was not created using NewL")); 
sl@0
   189
    		result = EFail;
sl@0
   190
    		User::Leave(KErrNoMemory);
sl@0
   191
    		}	
sl@0
   192
		CleanupStack::PopAndDestroy(camera);
sl@0
   193
		}
sl@0
   194
	else 
sl@0
   195
		{
sl@0
   196
		INFO_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
sl@0
   197
		result = EFail;	
sl@0
   198
		User::Leave(KErrNoMemory);	
sl@0
   199
		}
sl@0
   200
	__MM_HEAP_MARKEND;
sl@0
   201
	return result;
sl@0
   202
	}
sl@0
   203
sl@0
   204
RECamAdvSetNotificationTest* RECamAdvSetNotificationTest::NewL(TBool aAllocTest)
sl@0
   205
	{
sl@0
   206
	RECamAdvSetNotificationTest* self = new (ELeave) RECamAdvSetNotificationTest(aAllocTest);
sl@0
   207
	CleanupStack::PushL(self);
sl@0
   208
	self->ConstructL();
sl@0
   209
	CleanupStack::Pop(self);
sl@0
   210
	return self;	
sl@0
   211
	}
sl@0
   212
	
sl@0
   213
void RECamAdvSetNotificationTest::ConstructL()
sl@0
   214
	{
sl@0
   215
	iError = KErrNone;
sl@0
   216
	}
sl@0
   217
	
sl@0
   218
RECamAdvSetNotificationTest::RECamAdvSetNotificationTest(TBool /*aAllocTest*/)
sl@0
   219
	{
sl@0
   220
	iTestStepName = _L("MM-ECM-ADV-U-009-HP");
sl@0
   221
	}
sl@0
   222
sl@0
   223
TVerdict RECamAdvSetNotificationTest::DoTestStepL()
sl@0
   224
	{	
sl@0
   225
	TVerdict result = EPass;
sl@0
   226
	CCamera* camera = NULL;
sl@0
   227
	
sl@0
   228
	TInt error = KErrNone;
sl@0
   229
	TInt cameraIndex = 1;
sl@0
   230
	TBool cameraPresent = EFalse;
sl@0
   231
		
sl@0
   232
	__MM_HEAP_MARK;
sl@0
   233
	TInt cameras = CCamera::CamerasAvailable();
sl@0
   234
	INFO_PRINTF2(_L("Available %d cameras"), cameras);
sl@0
   235
	INFO_PRINTF1(_L("Create camera using Camera::New2L() and MCameraObserver2"));
sl@0
   236
	TRAP(error, camera = CCamera::New2L(*this, 0,0));
sl@0
   237
	if (error==KErrNone)
sl@0
   238
		{
sl@0
   239
		CleanupStack::PushL(camera);
sl@0
   240
		MCamManagement* extFunct = NULL;
sl@0
   241
sl@0
   242
	    // get the MCamera management inteface implementation
sl@0
   243
	    // remember it is for the purpose of this test written to 
sl@0
   244
	    // notify this camera clients... it should be a static(singlenton) 
sl@0
   245
	    // to cater for the general case, but this is just a test, not impl example. 
sl@0
   246
		extFunct = static_cast<CCamManagement*> 
sl@0
   247
			(camera->CustomInterface(KUidCameraManagementUid));
sl@0
   248
			
sl@0
   249
	    if (extFunct != NULL)
sl@0
   250
	    	{
sl@0
   251
	    	CleanupStack::PushL(extFunct);
sl@0
   252
	    	
sl@0
   253
	    	CCamera::CCameraAdvancedSettings* settings = static_cast<CCamera::CCameraAdvancedSettings*> (camera->CustomInterface(KECamAdvancedSettingUid));
sl@0
   254
	 		CleanupStack::PushL(settings);
sl@0
   255
	 		
sl@0
   256
	 		// enumerate camera types
sl@0
   257
	 		for (TInt index = 0; index < cameras; index++)
sl@0
   258
	 			{
sl@0
   259
	 			CCamera::CCameraAdvancedSettings::TCameraType type = settings->CameraType(index);
sl@0
   260
	 			INFO_PRINTF3(_L("camera with index %d type %d"), index, type);
sl@0
   261
	 			if (type == CCamera::CCameraAdvancedSettings::ECameraUnknown)
sl@0
   262
	 				{
sl@0
   263
	 				result = EFail;
sl@0
   264
	 				}
sl@0
   265
	 			}
sl@0
   266
	 			
sl@0
   267
	 		// check that indexed and non indexed versions work produce the same result
sl@0
   268
	 		INFO_PRINTF1(_L("Check that indexed and non indexed versions work in the same way"));
sl@0
   269
	 		TInt thisCameraIndex = 	settings->CameraIndex();
sl@0
   270
	 		// camera type
sl@0
   271
	       	if (settings->CameraType() != settings->CameraType(thisCameraIndex))
sl@0
   272
	       		{
sl@0
   273
	       		INFO_PRINTF2(_L("CameraType() and CameraType(%d) produce different results"),thisCameraIndex);
sl@0
   274
	       		result = EFail;
sl@0
   275
	       		}
sl@0
   276
	       	// for this camera
sl@0
   277
			settings->IsCameraPresent();
sl@0
   278
			if (settings->IsCameraPresent() != settings->IsCameraPresent(thisCameraIndex))
sl@0
   279
	       		{
sl@0
   280
	       		INFO_PRINTF2(_L("IsCameraPresent() and IsCameraPresent(%d) produce different results"),thisCameraIndex);
sl@0
   281
	       		result = EFail;
sl@0
   282
	       		}
sl@0
   283
	       		
sl@0
   284
	       	// verify that the required camera is not present - different index	
sl@0
   285
	 		cameraPresent = settings->IsCameraPresent(cameraIndex);
sl@0
   286
	 		INFO_PRINTF3(_L("camera with index %d %d"), cameraIndex, cameraPresent);
sl@0
   287
	    	if (cameraPresent)
sl@0
   288
	    		{
sl@0
   289
	    		result = EFail;
sl@0
   290
	    		}
sl@0
   291
	    		
sl@0
   292
	    	INFO_PRINTF2(_L("Plug in camera with index %d"), cameraIndex);
sl@0
   293
	    	extFunct->PlugCameraIn(cameraIndex);
sl@0
   294
	    	CheckNotification(KUidECamEventGlobalCamera01PluggedIn, result);	    	
sl@0
   295
    		
sl@0
   296
    		cameraPresent = settings->IsCameraPresent(cameraIndex);	
sl@0
   297
    		INFO_PRINTF3(_L("camera with index %d %d"), cameraIndex, cameraPresent);
sl@0
   298
    		if (!cameraPresent)
sl@0
   299
	    		{
sl@0
   300
	    		result = EFail;
sl@0
   301
	    		}
sl@0
   302
	    			
sl@0
   303
    		INFO_PRINTF2(_L("Plug out camera with index %d"), cameraIndex);
sl@0
   304
    		extFunct->PlugCameraOut(cameraIndex);
sl@0
   305
    	    CheckNotification(KUidECamEventGlobalCamera01PluggedOut, result);
sl@0
   306
    	        		
sl@0
   307
    		cameraPresent = settings->IsCameraPresent(cameraIndex);
sl@0
   308
    		INFO_PRINTF3(_L("camera with index %d %d"), cameraIndex, cameraPresent);	
sl@0
   309
    		if (cameraPresent)
sl@0
   310
	    		{
sl@0
   311
	    		result = EFail;
sl@0
   312
	    		}
sl@0
   313
	    		
sl@0
   314
	    	CleanupStack::PopAndDestroy(settings);	
sl@0
   315
	    	
sl@0
   316
	    	CleanupStack::Pop(extFunct);
sl@0
   317
	    	extFunct->Release();
sl@0
   318
	    	}
sl@0
   319
	    else
sl@0
   320
	    	{
sl@0
   321
	    	INFO_PRINTF1(_L("Could not obtain camera management interface?"));
sl@0
   322
	    	result = EFail;
sl@0
   323
	    	}
sl@0
   324
	    CleanupStack::PopAndDestroy(camera);	
sl@0
   325
		}
sl@0
   326
	    			
sl@0
   327
	else 
sl@0
   328
		{
sl@0
   329
		INFO_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
sl@0
   330
		result = EFail;		
sl@0
   331
		}
sl@0
   332
	__MM_HEAP_MARKEND;
sl@0
   333
	return result;
sl@0
   334
	}
sl@0
   335
	
sl@0
   336
	
sl@0
   337
//
sl@0
   338
// RECamAdvSetDefaultsTest //
sl@0
   339
//
sl@0
   340
RECamAdvSetDefaultsTest* RECamAdvSetDefaultsTest::NewL(TBool aAllocTest)
sl@0
   341
	{
sl@0
   342
	RECamAdvSetDefaultsTest* self = new (ELeave) RECamAdvSetDefaultsTest(aAllocTest);
sl@0
   343
	return self;	
sl@0
   344
	}
sl@0
   345
sl@0
   346
RECamAdvSetDefaultsTest::RECamAdvSetDefaultsTest(TBool)
sl@0
   347
	{
sl@0
   348
	iTestStepName = _L("MM-ECM-ADV-U-010-HP");
sl@0
   349
	}
sl@0
   350
	
sl@0
   351
TVerdict RECamAdvSetDefaultsTest::DoTestStepL()
sl@0
   352
	{	
sl@0
   353
	TVerdict result = EPass;
sl@0
   354
	CCamera* camera = NULL;
sl@0
   355
sl@0
   356
	TInt error = KErrNone;
sl@0
   357
	CCamera::CCameraAdvancedSettings* settings = NULL;
sl@0
   358
	
sl@0
   359
	__MM_HEAP_MARK;
sl@0
   360
	INFO_PRINTF1(_L("Create camera using Camera::New2L() and MCameraObserver2"));
sl@0
   361
	TRAP(error, camera = CCamera::New2L(*this, 0,0));
sl@0
   362
	if (error==KErrNone)
sl@0
   363
		{
sl@0
   364
		CleanupStack::PushL(camera);
sl@0
   365
		INFO_PRINTF1(_L("Create advanced settings from CCamera object"));
sl@0
   366
		settings = 	static_cast<CCamera::CCameraAdvancedSettings*> (camera->CustomInterface(KECamAdvancedSettingUid));
sl@0
   367
	    if (settings!= NULL)
sl@0
   368
	    	{
sl@0
   369
	    	CleanupStack::PushL(settings);
sl@0
   370
	    	
sl@0
   371
	    	// Supported Focus Modes. Set default Focus Mode. Get Focus Mode.
sl@0
   372
			iInputEventUid = KUidECamEventCameraSettingFocusMode;
sl@0
   373
	    	TInt suppFocusModes = settings->SupportedFocusModes();    	
sl@0
   374
	    	INFO_PRINTF2(_L("CCameraAdvancedSettings supported Focus Modes 0x%x"), suppFocusModes); 
sl@0
   375
	    	CCamera::CCameraAdvancedSettings::TFocusMode defaultFocusMode = CCamera::CCameraAdvancedSettings::EFocusModeAuto;
sl@0
   376
			settings->SetFocusMode(defaultFocusMode);
sl@0
   377
			
sl@0
   378
	        CheckNotification(iInputEventUid, result);
sl@0
   379
sl@0
   380
	    	CCamera::CCameraAdvancedSettings::TFocusMode retrievedFocusMode = settings->FocusMode();  			
sl@0
   381
	    	if (defaultFocusMode != retrievedFocusMode) 
sl@0
   382
	    		{
sl@0
   383
	   		 	INFO_PRINTF3(_L("CCameraAdvancedSettings retrieved Focus Mode 0x%x is not the default 0x%x "), 
sl@0
   384
	   		 					retrievedFocusMode, defaultFocusMode); 
sl@0
   385
	    		result = EFail;
sl@0
   386
	    		}
sl@0
   387
sl@0
   388
	    	// Supported Focus Range. Set default Focus Range. Get Focus Range.
sl@0
   389
			iInputEventUid = KUidECamEventCameraSettingFocusRange;	    	
sl@0
   390
	    	TInt suppFocusRanges = settings->SupportedFocusRanges();    	
sl@0
   391
	    	INFO_PRINTF2(_L("CCameraAdvancedSettings supported Focus Ranges 0x%x"), suppFocusRanges); 
sl@0
   392
	    	CCamera::CCameraAdvancedSettings::TFocusRange defaultFocusRange = CCamera::CCameraAdvancedSettings::EFocusRangeAuto;
sl@0
   393
			settings->SetFocusRange(defaultFocusRange);
sl@0
   394
			
sl@0
   395
			// Check for KUidECamEventCameraSettingFocusRange.
sl@0
   396
	        CheckNotification(iInputEventUid, result);
sl@0
   397
sl@0
   398
	    	CCamera::CCameraAdvancedSettings::TFocusRange retrievedFocusRange = settings->FocusRange();
sl@0
   399
	    	if (defaultFocusRange != retrievedFocusRange) 
sl@0
   400
	    		{
sl@0
   401
	   		 	INFO_PRINTF3(_L("CCameraAdvancedSettings retrieved Focus Range 0x%x is not the default 0x%x"), 
sl@0
   402
	   		 					retrievedFocusRange, defaultFocusRange); 
sl@0
   403
	    		result = EFail;
sl@0
   404
	    		}
sl@0
   405
	    		
sl@0
   406
	        // Check for KUidECamEventCameraSettingFocusRangeTwo.
sl@0
   407
	        iInputEventUid = KUidECamEventCameraSettingFocusRange2;
sl@0
   408
			CheckNotificationTwo(iInputEventUid, result);
sl@0
   409
				    	    	
sl@0
   410
	    	// Supported Auto Focus Type. Set default Auto Focus Type. Get Auto Focus Type.
sl@0
   411
			iInputEventUid = KUidECamEventCameraSettingAutoFocusType;	    	
sl@0
   412
	    	TInt suppAutoFocusTypes = settings->SupportedAutoFocusTypes();   
sl@0
   413
	    	INFO_PRINTF2(_L("CCameraAdvancedSettings supported Focus Types 0x%x"), suppAutoFocusTypes); 	    		
sl@0
   414
	    	CCamera::CCameraAdvancedSettings::TAutoFocusType defaultAutoFocusType = CCamera::CCameraAdvancedSettings::EAutoFocusTypeOff;
sl@0
   415
			settings->SetAutoFocusType(defaultAutoFocusType);
sl@0
   416
sl@0
   417
	        // Check for KUidECamEventCameraSettingAutoFocusType.
sl@0
   418
	        CheckNotification (iInputEventUid, result);
sl@0
   419
	    	
sl@0
   420
	    	CCamera::CCameraAdvancedSettings::TAutoFocusType retrievedAutoFocusType = settings->AutoFocusType() ;
sl@0
   421
	    	if (defaultAutoFocusType!=retrievedAutoFocusType) 
sl@0
   422
	    		{
sl@0
   423
		    	INFO_PRINTF3(_L("CCameraAdvancedSettings retrieved Auto Focus Type 0x%x is not the default 0x%x"), 
sl@0
   424
	    					retrievedAutoFocusType, defaultAutoFocusType);
sl@0
   425
 	    		result = EFail;
sl@0
   426
	    		}
sl@0
   427
	    	
sl@0
   428
	    	// Check for KUidECamEventCameraSettingAutoFocusTypeTwo
sl@0
   429
			iInputEventUid = KUidECamEventCameraSettingAutoFocusType2;	    	
sl@0
   430
	    	CheckNotificationTwo(iInputEventUid, result);	
sl@0
   431
	    				
sl@0
   432
	    	// Supported Auto Focus Area. Set default Auto Focus Area. Get Auto Focus Area.
sl@0
   433
			iInputEventUid = KUidECamEventCameraSettingAutoFocusArea;	    	
sl@0
   434
	    	TInt suppAutoFocusArea = settings->SupportedAutoFocusAreas();    	
sl@0
   435
	    	INFO_PRINTF2(_L("CCameraAdvancedSettings supported Focus Areas 0x%x"), suppAutoFocusArea); 	    		
sl@0
   436
	    	CCamera::CCameraAdvancedSettings::TAutoFocusArea defaultAutoFocusArea = CCamera::CCameraAdvancedSettings::EAutoFocusTypeAuto;
sl@0
   437
			settings->SetAutoFocusArea(defaultAutoFocusArea);
sl@0
   438
sl@0
   439
	        CheckNotification(iInputEventUid, result);
sl@0
   440
	        
sl@0
   441
	    	CCamera::CCameraAdvancedSettings::TAutoFocusArea retrievedAutoFocusArea = settings->AutoFocusArea() ;
sl@0
   442
	    	if (defaultAutoFocusArea!=retrievedAutoFocusArea) 
sl@0
   443
	    		{
sl@0
   444
		    	INFO_PRINTF3(_L("CCameraAdvancedSettings retrieved Auto Focus Area  0x%x is not the default 0x%x"), 
sl@0
   445
	    					retrievedAutoFocusArea, defaultAutoFocusArea); 
sl@0
   446
	    		result = EFail;
sl@0
   447
	    		}	
sl@0
   448
	    		
sl@0
   449
	    	// Focus distance
sl@0
   450
			iInputEventUid = KUidECamEventCameraSettingFocusDistance;	    	
sl@0
   451
	    	TInt dummyFocusDistance = 3;
sl@0
   452
			settings->SetFocusDistance(dummyFocusDistance);
sl@0
   453
sl@0
   454
	        CheckNotification(iInputEventUid, result);
sl@0
   455
	    	
sl@0
   456
	    	TInt retrievedFocusDist = settings->FocusDistance();  
sl@0
   457
	    	if (dummyFocusDistance!=retrievedFocusDist) 
sl@0
   458
	    		{
sl@0
   459
		    	INFO_PRINTF3(_L("CCameraAdvancedSettings Focus distance  0x%x is not as expected 0x%x"), 
sl@0
   460
	    					dummyFocusDistance, retrievedFocusDist); 
sl@0
   461
	    		result = EFail;
sl@0
   462
	    		}	
sl@0
   463
	    			    			
sl@0
   464
	    	// Min Focal Length
sl@0
   465
	    	TInt minFocalLength = settings->GetMinFocalLength();    
sl@0
   466
	    	if (KErrNotSupported!=minFocalLength) 
sl@0
   467
	    		{
sl@0
   468
	    		INFO_PRINTF1(_L("Supported min Focal Length"));
sl@0
   469
	    		result = EFail;
sl@0
   470
	    		} 	    	
sl@0
   471
   		
sl@0
   472
			// Supported Iso Rates. Set default Iso Rate. Get Iso Rate. OLD API
sl@0
   473
			iInputEventUid = KUidECamEventCameraSettingIsoRate;
sl@0
   474
			RArray<TInt> isoRates;
sl@0
   475
			TInt suppIsoRates = 0;
sl@0
   476
			settings->GetSupportedIsoRatesL(isoRates);  
sl@0
   477
			suppIsoRates =  isoRates[0];
sl@0
   478
			isoRates.Close();
sl@0
   479
			INFO_PRINTF2(_L("CCameraAdvancedSettings supported Iso Rates 0x%x"), suppIsoRates); 	    		
sl@0
   480
			TInt defaultIsoRate = KDefaultIsoRating;
sl@0
   481
			settings->SetIsoRate(defaultIsoRate);    
sl@0
   482
sl@0
   483
			CheckNotification(iInputEventUid, result);
sl@0
   484
	        
sl@0
   485
	    	TInt retrievedIsoRate = settings->IsoRate();    		
sl@0
   486
	    	if (defaultIsoRate!=retrievedIsoRate) 
sl@0
   487
	    		{
sl@0
   488
		    	INFO_PRINTF3(_L("CCameraAdvancedSettings Iso Rate %d is not as expected %d"), 
sl@0
   489
	    					defaultIsoRate, retrievedIsoRate); 
sl@0
   490
	    		result = EFail;
sl@0
   491
	    		}
sl@0
   492
	    
sl@0
   493
	    	CCamera::CCameraAdvancedSettings::TISORateType isoRateType; 
sl@0
   494
			TInt param =0;
sl@0
   495
			TInt isoRate =0;
sl@0
   496
	    	settings->GetISORateL(isoRateType, param, isoRate);
sl@0
   497
	    	
sl@0
   498
	    	if (isoRateType != CCamera::CCameraAdvancedSettings::EISOManual) 
sl@0
   499
	    		{
sl@0
   500
		    	INFO_PRINTF3(_L("CCameraAdvancedSettings New and Old API for Iso Rate Type not consistent  0x%x is not as expected 0x%x"), 
sl@0
   501
	    					isoRateType, CCamera::CCameraAdvancedSettings::EISOManual); 
sl@0
   502
	    		result = EFail;
sl@0
   503
	    		}
sl@0
   504
	    	
sl@0
   505
	    	if (defaultIsoRate != isoRate) 
sl@0
   506
	    		{
sl@0
   507
		    	INFO_PRINTF3(_L("CCameraAdvancedSettings New and Old API for Iso Rate not consistent %d is not as expected %d"), 
sl@0
   508
	    					isoRate, defaultIsoRate); 
sl@0
   509
	    		result = EFail;
sl@0
   510
	    		}
sl@0
   511
	    			
sl@0
   512
	       	// Supported Iso Types. Set default Iso Type. Set Default ISO Rate. Get Iso Type and Rate. New API
sl@0
   513
	    	iInputEventUid = KUidECamEventCameraSettingIsoRateType;
sl@0
   514
			
sl@0
   515
			TInt supportedISORateTypes = 0;
sl@0
   516
			settings->GetSupportedISORateTypeL(supportedISORateTypes);  
sl@0
   517
			
sl@0
   518
			INFO_PRINTF2(_L("CCameraAdvancedSettings supported Iso Rate Types 0x%x"), supportedISORateTypes); 	    		
sl@0
   519
			defaultIsoRate = KDefaultIsoRating;
sl@0
   520
			CCamera::CCameraAdvancedSettings::TISORateType defaultIsoRateType = CCamera::CCameraAdvancedSettings::EISOManual;
sl@0
   521
			if(defaultIsoRateType & supportedISORateTypes)
sl@0
   522
				{
sl@0
   523
				settings->SetISORateL(defaultIsoRateType, defaultIsoRate);
sl@0
   524
				
sl@0
   525
				CheckNotification(iInputEventUid, result);
sl@0
   526
				
sl@0
   527
				param =0;
sl@0
   528
				isoRate =0;	
sl@0
   529
							
sl@0
   530
				settings->GetISORateL(isoRateType, param, isoRate);
sl@0
   531
				
sl@0
   532
				if(isoRateType != defaultIsoRateType)
sl@0
   533
					{
sl@0
   534
					INFO_PRINTF3(_L("CCameraAdvancedSettings Iso Rate Type 0x%x is not as expected 0x%x"), 
sl@0
   535
	    					isoRateType, defaultIsoRateType); 
sl@0
   536
	    			result = EFail;
sl@0
   537
					}
sl@0
   538
					
sl@0
   539
				if(isoRate != defaultIsoRate)
sl@0
   540
					{
sl@0
   541
					INFO_PRINTF3(_L("CCameraAdvancedSettings Iso Rate %d is not as expected %d"), 
sl@0
   542
	    					isoRate, defaultIsoRate); 
sl@0
   543
	    			result = EFail;
sl@0
   544
					}
sl@0
   545
				}
sl@0
   546
				    	
sl@0
   547
	    	// Supported apertures. Set and Get aperture.
sl@0
   548
	    	iInputEventUid = KUidECamEventCameraSettingAperture;
sl@0
   549
	    	RArray<TInt> suppApertures; 
sl@0
   550
	    	TValueInfo valueInfo = ENotActive;
sl@0
   551
	    	settings->GetAperturesL(suppApertures, valueInfo);   
sl@0
   552
			// should not have entries
sl@0
   553
			if (suppApertures.Count() != 0)
sl@0
   554
				{
sl@0
   555
				result = EFail;
sl@0
   556
				}	   
sl@0
   557
				 	
sl@0
   558
			TInt dummyAperture = KDefaultAperture;
sl@0
   559
			settings->SetAperture(dummyAperture);	    	 	
sl@0
   560
	        
sl@0
   561
	        CheckNotification(iInputEventUid, result);
sl@0
   562
sl@0
   563
	    	TInt aperture = settings->Aperture() ;
sl@0
   564
	    	if (dummyAperture != aperture) 
sl@0
   565
	    		{
sl@0
   566
		    	INFO_PRINTF3(_L("CCameraAdvancedSettings Aperture  0x%x is not as expected 0x%x"), 
sl@0
   567
	    					dummyAperture, aperture); 
sl@0
   568
sl@0
   569
	    		result = EFail;
sl@0
   570
	    		}
sl@0
   571
sl@0
   572
	    	// Supported shutter speed. Set and Get shutter speed
sl@0
   573
	    	iInputEventUid = KUidECamEventCameraSettingShutterSpeed;
sl@0
   574
	    	RArray<TInt> suppShutterSpeed; 
sl@0
   575
	    	TValueInfo shutterSpeedValueInfo = ENotActive;
sl@0
   576
	    	settings->GetShutterSpeedsL(suppShutterSpeed, shutterSpeedValueInfo );   
sl@0
   577
			// should not have entries
sl@0
   578
			if (suppShutterSpeed.Count() != 0)
sl@0
   579
				{
sl@0
   580
				result = EFail;
sl@0
   581
				}
sl@0
   582
					    	
sl@0
   583
			TInt dummyShutterSpeed = KShutterSpeed;
sl@0
   584
			settings->SetShutterSpeed(dummyShutterSpeed);	    	 	
sl@0
   585
	        
sl@0
   586
	        CheckNotification(iInputEventUid, result);
sl@0
   587
sl@0
   588
	    	TInt shutterSpeed = settings->ShutterSpeed() ;
sl@0
   589
	    	if (dummyShutterSpeed != shutterSpeed) 
sl@0
   590
	    		{
sl@0
   591
		    	INFO_PRINTF3(_L("CCameraAdvancedSettings Shutter Speed  0x%x is not as expected 0x%x"), 
sl@0
   592
	    					dummyShutterSpeed, shutterSpeed); 
sl@0
   593
sl@0
   594
	    		result = EFail;
sl@0
   595
	    		}	    	
sl@0
   596
	    		
sl@0
   597
   			// Supported Metering Modes
sl@0
   598
	    	iInputEventUid = KUidECamEventCameraSettingMeteringMode;
sl@0
   599
	    	TInt suppMeteringModes = settings->SupportedMeteringModes();
sl@0
   600
	    	INFO_PRINTF2(_L("CCameraAdvancedSettings supported Metering Modes 0x%x"), suppMeteringModes); 	    		
sl@0
   601
	    	CCamera::CCameraAdvancedSettings::TMeteringMode defaultMeteringMode = CCamera::CCameraAdvancedSettings::EMeteringModeAuto;
sl@0
   602
	    	settings->SetMeteringMode(defaultMeteringMode);    
sl@0
   603
sl@0
   604
	        CheckNotification (iInputEventUid, result);
sl@0
   605
	        
sl@0
   606
	    	CCamera::CCameraAdvancedSettings::TMeteringMode retrievedMeteringMode = settings->MeteringMode() ;    		
sl@0
   607
	    	if (defaultMeteringMode != retrievedMeteringMode) 
sl@0
   608
	    		{
sl@0
   609
		    	INFO_PRINTF3(_L("CCameraAdvancedSettings Metering Mode  0x%x is not as expected 0x%x"), 
sl@0
   610
	    					defaultMeteringMode, retrievedMeteringMode); 
sl@0
   611
	    		result = EFail;
sl@0
   612
	    		}
sl@0
   613
sl@0
   614
sl@0
   615
   			// Supported Bracket Modes
sl@0
   616
	    	iInputEventUid = KUidECamEventCameraSettingBracketMode;
sl@0
   617
	    	TInt suppBracketModes = settings->SupportedBracketModes();
sl@0
   618
	    	INFO_PRINTF2(_L("CCameraAdvancedSettings supported Bracket Modes 0x%x"), suppBracketModes); 	    		
sl@0
   619
	    	CCamera::CCameraAdvancedSettings::TBracketMode defaultBracketMode = CCamera::CCameraAdvancedSettings::EBracketModeOff;
sl@0
   620
	    	settings->SetBracketMode(defaultBracketMode);    
sl@0
   621
sl@0
   622
	        CheckNotification(iInputEventUid, result);	
sl@0
   623
	        
sl@0
   624
	    	CCamera::CCameraAdvancedSettings::TBracketMode retrievedBracketMode = settings->BracketMode() ;    		
sl@0
   625
	    	if (defaultBracketMode != retrievedBracketMode) 
sl@0
   626
	    		{
sl@0
   627
		    	INFO_PRINTF3(_L("CCameraAdvancedSettings Drive Mode  0x%x is not as expected 0x%x"), 
sl@0
   628
	    					defaultBracketMode, retrievedBracketMode); 
sl@0
   629
	    		result = EFail;
sl@0
   630
	    		}    		
sl@0
   631
sl@0
   632
sl@0
   633
			// Supported AF assistant light. Set and Get AF assistant light.
sl@0
   634
			iInputEventUid = KUidECamEventCameraSettingAFAssistantLight;
sl@0
   635
	    	TInt suppAFAssistantLights =0;
sl@0
   636
	    	
sl@0
   637
	    	settings->GetSupportedAFAssistantLightL(suppAFAssistantLights);
sl@0
   638
	    	 
sl@0
   639
	    	INFO_PRINTF2(_L("CCameraAdvancedSettings supported AF Assistant Lights 0x%x"), suppAFAssistantLights); 	    		
sl@0
   640
	    	CCamera::CCameraAdvancedSettings::TAFAssistantLight defaultAFAssistantLight = CCamera::CCameraAdvancedSettings::EAFAssistantLightOff;
sl@0
   641
	    	settings->SetAFAssistantLightL(defaultAFAssistantLight);    
sl@0
   642
			
sl@0
   643
	        CheckNotification(iInputEventUid, result);	
sl@0
   644
	        
sl@0
   645
	    	CCamera::CCameraAdvancedSettings::TAFAssistantLight retrievedAFAssistantLight;
sl@0
   646
	    	settings->GetAFAssistantLightL(retrievedAFAssistantLight); 
sl@0
   647
	    	   		
sl@0
   648
	    	if (defaultAFAssistantLight != retrievedAFAssistantLight) 
sl@0
   649
	    		{
sl@0
   650
		    	INFO_PRINTF3(_L("CCameraAdvancedSettings AF Assistant Light  0x%x is not as expected 0x%x"), 
sl@0
   651
	    					retrievedAFAssistantLight, defaultAFAssistantLight); 
sl@0
   652
	    		result = EFail;
sl@0
   653
	    		}  
sl@0
   654
	    	
sl@0
   655
	    	TInt preCaptureWarningSupported = KAllPreCaptureWarnings; // ( = 0x3FFF)	
sl@0
   656
	    	settings->GetPreCaptureWarningSupportedL(CCamera::CCameraAdvancedSettings::EModeIdle, preCaptureWarningSupported);	
sl@0
   657
	    	
sl@0
   658
	    	// subscribe for pre capture warnings. Poll for it. Unsubscribe for Pre capture warning.
sl@0
   659
	    	settings->SubscribeToPreCaptureWarningL(preCaptureWarningSupported);
sl@0
   660
	    	
sl@0
   661
	    	//Poll to know the status of every possible warning ...
sl@0
   662
	    	TInt warningStatus =0;
sl@0
   663
	    	settings->GetPreCaptureWarningL(warningStatus);
sl@0
   664
	    	
sl@0
   665
	    	settings->UnSubscribePreCaptureWarningL();
sl@0
   666
	    	
sl@0
   667
	    	//set reference screen 
sl@0
   668
	    	iInputEventUid = KUidECamEventCameraSettingReferenceScreen;
sl@0
   669
	    	
sl@0
   670
	    	CWsScreenDevice* screenDevice = NULL; 
sl@0
   671
	    	// prepare the screen targetted.
sl@0
   672
	    		    	
sl@0
   673
	    	settings->SetReferenceScreenL(*screenDevice);
sl@0
   674
	    	 
sl@0
   675
	        CheckNotification(iInputEventUid, result);	
sl@0
   676
	    	
sl@0
   677
sl@0
   678
		   INFO_PRINTF1(_L("API exercise"));
sl@0
   679
		   // API exercise
sl@0
   680
	       TBool lock = ETrue;
sl@0
   681
	       TInt value = KValue;
sl@0
   682
	       settings->SetApertureExposureLockOn(lock);
sl@0
   683
	       settings->ApertureExposureLockOn();
sl@0
   684
	       
sl@0
   685
	       	// Automatic selection
sl@0
   686
	       	settings->SetAutomaticSizeSelectionChangeOn(EFalse);
sl@0
   687
	       	settings->AutomaticSizeSelectionChangeOn();
sl@0
   688
	       	
sl@0
   689
			// stabilization mode
sl@0
   690
			// settings
sl@0
   691
			settings->SupportedStabilizationModes();
sl@0
   692
			settings->StabilizationMode();
sl@0
   693
			settings->SetStabilizationMode(CCamera::CCameraAdvancedSettings::EStabilizationModeVertical);
sl@0
   694
sl@0
   695
			settings->SupportedBracketParameters();
sl@0
   696
			settings->BracketParameter();
sl@0
   697
			settings->SetBracketParameter(CCamera::CCameraAdvancedSettings::BracketParameterAutoFocus);
sl@0
   698
			settings->SupportedBracketSteps();
sl@0
   699
			settings->BracketStep();
sl@0
   700
			settings->SetBracketStep(CCamera::CCameraAdvancedSettings::EBracketStepMedium); 
sl@0
   701
			
sl@0
   702
			TInt startIndex;
sl@0
   703
			TInt frames;
sl@0
   704
			
sl@0
   705
			settings->GetBracketMerge(startIndex, frames); 
sl@0
   706
			settings->SetBracketMerge(startIndex, frames);
sl@0
   707
			
sl@0
   708
			settings->SupportedFlashModes();
sl@0
   709
			settings->FlashMode();
sl@0
   710
			settings->SetFlashMode(CCamera::EFlashSlowRearSync);
sl@0
   711
			settings->RedEyeReduceOn();
sl@0
   712
			settings->SetRedEyeReduceOn(EFalse);
sl@0
   713
			
sl@0
   714
			RArray<TInt> steps;
sl@0
   715
			TValueInfo info;
sl@0
   716
			
sl@0
   717
			settings->GetFlashCompensationStepsL(steps, info);
sl@0
   718
			TInt flashCompensationStep1 = settings->FlashCompensationStep();
sl@0
   719
			if(flashCompensationStep1 != KFlashCompensationStep)
sl@0
   720
				{
sl@0
   721
				INFO_PRINTF2(_L("old method for FlashCompensationStep retrieving wrong value %d"),flashCompensationStep1); 	    
sl@0
   722
				result = EFail;
sl@0
   723
				}
sl@0
   724
				
sl@0
   725
			TInt flashCompensationStep2 = 0;
sl@0
   726
			TInt err = settings->GetFlashCompensationStep(flashCompensationStep2);
sl@0
   727
			if(flashCompensationStep1 != flashCompensationStep2)
sl@0
   728
				{
sl@0
   729
				INFO_PRINTF1(_L("old and new method for FlashCompensationStep retrieving wrong/dissimilar values")); 	    
sl@0
   730
				result = EFail;
sl@0
   731
				}
sl@0
   732
			if(err)
sl@0
   733
				{
sl@0
   734
				INFO_PRINTF2(_L("new method for FlashCompensationStep had error %d"),err); 	    
sl@0
   735
				result = EFail;
sl@0
   736
				}
sl@0
   737
			
sl@0
   738
			settings->SetFlashCompensationStep(value);
sl@0
   739
			TRAP(error, settings->GetCurrentFocusModeStepsL(steps, info));
sl@0
   740
			
sl@0
   741
			TInt negValue;
sl@0
   742
			TInt posValue;
sl@0
   743
			TBool ready = ETrue;
sl@0
   744
			
sl@0
   745
			settings->GetFlashCompensationRangeInSteps(negValue, posValue);
sl@0
   746
			TInt flashCompensation1 = settings->FlashCompensation();
sl@0
   747
			if(flashCompensation1 != KFlashCompensationInSteps)
sl@0
   748
				{
sl@0
   749
				INFO_PRINTF2(_L("old method for FlashCompensation retrieving wrong value %d"),flashCompensation1); 	    
sl@0
   750
				result = EFail;
sl@0
   751
				}
sl@0
   752
			TInt flashCompensation2 = 0;
sl@0
   753
			err = settings->GetFlashCompensation(flashCompensation2);
sl@0
   754
			
sl@0
   755
			if(flashCompensation1 != flashCompensation2)
sl@0
   756
				{
sl@0
   757
				INFO_PRINTF1(_L("old and new method for FlashCompensation retrieving wrong/dissimilar values")); 	    
sl@0
   758
				result = EFail;
sl@0
   759
				}
sl@0
   760
			if(err)
sl@0
   761
				{
sl@0
   762
				INFO_PRINTF2(_L("new method for FlashCompensation had error %d"),err); 	    
sl@0
   763
				result = EFail;
sl@0
   764
				}
sl@0
   765
			
sl@0
   766
			settings->SetFlashCompensation(value);
sl@0
   767
			
sl@0
   768
			settings->IsFlashReady(ready);
sl@0
   769
			if(ready != EFalse) // The value the pugin has been set to return
sl@0
   770
				{
sl@0
   771
				result = EFail;	
sl@0
   772
				}
sl@0
   773
			settings->IsExternalFlashPresent();
sl@0
   774
			settings->GetManualFlashPowerLevelsL(steps, info);
sl@0
   775
			settings->SetManualFlashPowerLevel(value);
sl@0
   776
			settings->ManualFlashPowerLevel();
sl@0
   777
			
sl@0
   778
			settings->SupportedExposureModes();
sl@0
   779
			settings->ExposureMode();
sl@0
   780
			settings->SetExposureMode(CCamera::EExposureAuto);
sl@0
   781
			
sl@0
   782
 			settings->GetExposureCompensationStepsL(steps, info);
sl@0
   783
 			TInt expCompensationStep1 = settings->ExposureCompensationStep();
sl@0
   784
 			if(expCompensationStep1 != KExposureCompensationStep)
sl@0
   785
				{
sl@0
   786
				INFO_PRINTF2(_L("old method for ExposureCompensationStep retrieving wrong value %d"),expCompensationStep1); 	    
sl@0
   787
				result = EFail;
sl@0
   788
				}
sl@0
   789
				
sl@0
   790
			TInt expCompensationStep2 = 0;
sl@0
   791
			err = settings->GetExposureCompensationStep(expCompensationStep2);
sl@0
   792
			if(expCompensationStep1 != expCompensationStep2)
sl@0
   793
				{
sl@0
   794
				INFO_PRINTF1(_L("old and new method for ExposureCompensationStep retrieving wrong/dissimilar values")); 	    
sl@0
   795
				result = EFail;
sl@0
   796
				}
sl@0
   797
			if(err)
sl@0
   798
				{
sl@0
   799
				INFO_PRINTF2(_L("new method for ExposureCompensationStep had error %d"),err); 	    
sl@0
   800
				result = EFail;
sl@0
   801
				}
sl@0
   802
			settings->SetExposureCompensationStep(value);
sl@0
   803
sl@0
   804
			settings->GetExposureCompensationRangeInSteps(negValue, posValue);
sl@0
   805
			TInt expCompensation1 = settings->ExposureCompensation();
sl@0
   806
			if(expCompensation1 != KExposureCompensationInSteps)
sl@0
   807
				{
sl@0
   808
				INFO_PRINTF2(_L("old method for ExposureCompensation retrieving wrong value %d"),expCompensation1); 	    
sl@0
   809
				result = EFail;
sl@0
   810
				}
sl@0
   811
				
sl@0
   812
			TInt expCompensation2 = 0;
sl@0
   813
			err = settings->GetExposureCompensation(expCompensation2);
sl@0
   814
			
sl@0
   815
			if(expCompensation1 != expCompensation2)
sl@0
   816
				{
sl@0
   817
				INFO_PRINTF1(_L("old and new method for ExposureCompensation retrieving wrong/dissimilar values")); 	    
sl@0
   818
				result = EFail;
sl@0
   819
				}
sl@0
   820
			if(err)
sl@0
   821
				{
sl@0
   822
				INFO_PRINTF2(_L("new method for ExposureCompensation had error %d"),err); 	    
sl@0
   823
				result = EFail;
sl@0
   824
				}
sl@0
   825
			settings->SetExposureCompensation(value);
sl@0
   826
		
sl@0
   827
			settings->SupportedWhiteBalanceModes();
sl@0
   828
			settings->WhiteBalanceMode();
sl@0
   829
			settings->SetWhiteBalanceMode(CCamera::EWBAuto);
sl@0
   830
			
sl@0
   831
			settings->ShootClickOn();
sl@0
   832
			settings->SetShootClickOn(EFalse);
sl@0
   833
			settings->GetTimerIntervalsL(steps, info);
sl@0
   834
			settings->TimerInterval();
sl@0
   835
			settings->SetTimerInterval(value);
sl@0
   836
sl@0
   837
			TTime start;
sl@0
   838
			TTime end;
sl@0
   839
			TTime interval;
sl@0
   840
sl@0
   841
			settings->GetTimeLapsePeriodRange(start, end);
sl@0
   842
			settings->GetTimeLapse(start, end, interval);
sl@0
   843
			settings->SetTimeLapse(start, end, interval);
sl@0
   844
			
sl@0
   845
			settings->PictureOrientation();
sl@0
   846
			settings->SetPictureOrientation(CCamera::CCameraAdvancedSettings::EPictureOrientationPortrait);
sl@0
   847
		
sl@0
   848
			settings->SupportedPixelAspectRatios();
sl@0
   849
			settings->PixelAspectRatio();
sl@0
   850
			settings->SetPixelAspectRatio(CCamera::CCameraAdvancedSettings::EPixelAspect1To1);
sl@0
   851
			settings->SupportedYuvRanges();
sl@0
   852
			settings->YuvRange();
sl@0
   853
			settings->SetYuvRange(CCamera::CCameraAdvancedSettings::EYuvRangeVideoCropped);
sl@0
   854
			settings->BurstImages();
sl@0
   855
			settings->SetBurstImages(value); 
sl@0
   856
			settings->GetOpticalZoomStepsL(steps, info);
sl@0
   857
			settings->OpticalZoom();
sl@0
   858
			settings->SetOpticalZoom(value);
sl@0
   859
			settings->GetDigitalZoomStepsL(steps, info);
sl@0
   860
			settings->DigitalZoom();
sl@0
   861
			settings->SetDigitalZoom(value);
sl@0
   862
			
sl@0
   863
			TInt sizeIndex =0;
sl@0
   864
			TBool isInfluencePossible;
sl@0
   865
			CCamera::TFormat format = CCamera::EFormatYUV420Planar;
sl@0
   866
			settings->GetDigitalZoomStepsForStillL(steps, info, sizeIndex, format, isInfluencePossible);
sl@0
   867
			settings->DigitalZoom();
sl@0
   868
			settings->SetDigitalZoom(value);
sl@0
   869
			
sl@0
   870
			TInt frameRateIndex =0;
sl@0
   871
			CCamera::TExposure exposure = CCamera::EExposureAuto;
sl@0
   872
			settings->GetDigitalZoomStepsForVideoL(steps, info, frameRateIndex, sizeIndex, format, isInfluencePossible, exposure);
sl@0
   873
			settings->DigitalZoom();
sl@0
   874
			settings->SetDigitalZoom(value);
sl@0
   875
sl@0
   876
			settings->ExposureLockOn();
sl@0
   877
			settings->SetExposureLockOn(EFalse);
sl@0
   878
			settings->AutoFocusLockOn();
sl@0
   879
			settings->SetAutoFocusLockOn(EFalse);
sl@0
   880
			
sl@0
   881
			// timeouts
sl@0
   882
			RArray<TInt> timeouts;
sl@0
   883
    		settings->GetSupportedContinuousAutoFocusTimeoutsL(timeouts, info);
sl@0
   884
    		timeouts.Close();
sl@0
   885
    		settings->ContinuousAutoFocusTimeout();
sl@0
   886
    		settings->SetContinuousAutoFocusTimeout(KContinuousAutoFocusTimeoutValue1);
sl@0
   887
    		
sl@0
   888
    		// stabilization effects
sl@0
   889
	        settings->SupportedStabilizationEffects();
sl@0
   890
    		settings->SetStabilizationEffect(CCamera::CCameraAdvancedSettings::EStabilizationAuto);
sl@0
   891
			CCamera::CCameraAdvancedSettings::TStabilizationEffect effect = settings->StabilizationEffect();
sl@0
   892
	        
sl@0
   893
	        // stabilization complexity
sl@0
   894
			settings->SupportedStabilizationComplexityValues();
sl@0
   895
			CCamera::CCameraAdvancedSettings::TStabilizationAlgorithmComplexity complexity = settings->StabilizationComplexity();
sl@0
   896
			settings->SetStabilizationComplexity(CCamera::CCameraAdvancedSettings::EStabilizationComplexityAuto);
sl@0
   897
            
sl@0
   898
            // ISO rate type
sl@0
   899
	    	iInputEventUid = KUidECamEventCameraSettingIsoRateType;
sl@0
   900
			
sl@0
   901
			supportedISORateTypes = 0;
sl@0
   902
			settings->GetSupportedISORateTypeL(supportedISORateTypes);  
sl@0
   903
			
sl@0
   904
			INFO_PRINTF2(_L("CCameraAdvancedSettings supported Iso Rate Types 0x%x"), supportedISORateTypes); 	    
sl@0
   905
			
sl@0
   906
			//List of supported ISO rates can be found using OLD API.
sl@0
   907
			RArray<TInt> supportedIsoRates;
sl@0
   908
			settings->GetSupportedIsoRatesL(supportedIsoRates);  
sl@0
   909
			
sl@0
   910
			//set to manual ISO rate
sl@0
   911
			isoRateType = CCamera::CCameraAdvancedSettings::EISOManual;
sl@0
   912
			if(isoRateType & supportedISORateTypes)
sl@0
   913
				{
sl@0
   914
				INFO_PRINTF1(_L("Testing new ISO API for CCamera::CCameraAdvancedSettings::EISOManual")); 
sl@0
   915
				TestISOTypesL(settings, isoRateType, supportedIsoRates, result);
sl@0
   916
				}
sl@0
   917
			
sl@0
   918
			//switch to unprioritised type of Auto ISO...
sl@0
   919
			isoRateType = CCamera::CCameraAdvancedSettings::EISOAutoUnPrioritised;
sl@0
   920
			if(isoRateType & supportedISORateTypes)
sl@0
   921
				{
sl@0
   922
				INFO_PRINTF1(_L("Testing new ISO API for CCamera::CCameraAdvancedSettings::EISOAutoUnPrioritised")); 
sl@0
   923
				TestISOTypesL(settings, isoRateType, supportedIsoRates, result);
sl@0
   924
				}
sl@0
   925
			
sl@0
   926
			//switch to ISO prioritised AutoISO ...	
sl@0
   927
			isoRateType = CCamera::CCameraAdvancedSettings::EISOAutoISOPrioritised;
sl@0
   928
			if(isoRateType & supportedISORateTypes)
sl@0
   929
				{
sl@0
   930
				INFO_PRINTF1(_L("Testing new ISO API for CCamera::CCameraAdvancedSettings::EISOAutoISOPrioritised")); 
sl@0
   931
				TestISOTypesL(settings, isoRateType, supportedIsoRates, result);
sl@0
   932
				}
sl@0
   933
			
sl@0
   934
			//switch to shutter speed prioritised AutoISO...	
sl@0
   935
			isoRateType = CCamera::CCameraAdvancedSettings::EISOAutoShutterSpeedPrioritised;	
sl@0
   936
			if(isoRateType & supportedISORateTypes)
sl@0
   937
				{
sl@0
   938
				INFO_PRINTF1(_L("Testing new ISO API for CCamera::CCameraAdvancedSettings::EISOAutoShutterSpeedPrioritised")); 
sl@0
   939
				TestISOTypesL(settings, isoRateType, supportedIsoRates, result);
sl@0
   940
				}
sl@0
   941
			
sl@0
   942
			//switch to aperture prioritised AutoISO...	
sl@0
   943
			isoRateType = CCamera::CCameraAdvancedSettings::EISOAutoAperturePrioritised;	
sl@0
   944
			if(isoRateType & supportedISORateTypes)
sl@0
   945
				{
sl@0
   946
				INFO_PRINTF1(_L("Testing new ISO API for CCamera::CCameraAdvancedSettings::EISOAutoAperturePrioritised")); 
sl@0
   947
				TestISOTypesL(settings, isoRateType, supportedIsoRates, result);
sl@0
   948
				}
sl@0
   949
				
sl@0
   950
            supportedIsoRates.Close();
sl@0
   951
            
sl@0
   952
            // all functions are called, irrespective of the units; in real case will be one set or the other 
sl@0
   953
            TRgb rgb(100,124,130);
sl@0
   954
		    CCamera::CCameraAdvancedSettings::TWBUnits units = settings->SupportedWBUnits();
sl@0
   955
		    settings->SetWBRgbValue(rgb);
sl@0
   956
			settings->GetWBRgbValue(rgb);
sl@0
   957
			RArray<TInt> temperatures;
sl@0
   958
			settings->GetWBSupportedColorTemperaturesL(temperatures, info);
sl@0
   959
			temperatures.Close();
sl@0
   960
			settings->SetWBColorTemperature(KWBColorTemperature1);	
sl@0
   961
			TInt temp = settings->WBColorTemperature();
sl@0
   962
			
sl@0
   963
			INFO_PRINTF1(_L("GetFocalLengthInfoL method invocation"));
sl@0
   964
			TInt currentFocalLength=0; 
sl@0
   965
			TInt maxFocalLength=0;
sl@0
   966
			TRAP(err, settings->GetFocalLengthInfoL(minFocalLength, currentFocalLength, maxFocalLength));
sl@0
   967
			if(err != KErrNotSupported)
sl@0
   968
				{
sl@0
   969
				INFO_PRINTF1(_L("GetFocalLengthInfoL supported!")); 
sl@0
   970
				result = EFail;
sl@0
   971
				}
sl@0
   972
			
sl@0
   973
			INFO_PRINTF1(_L("GetNumOperationPreferenceL method invocation"));	
sl@0
   974
			TUint numOperationPreferenceSupported=0;
sl@0
   975
	        TRAP(err, settings->GetNumOperationPreferenceL(numOperationPreferenceSupported));
sl@0
   976
			if(err != KErrNotSupported)
sl@0
   977
				{
sl@0
   978
				INFO_PRINTF1(_L("GetNumOperationPreferenceL supported!")); 
sl@0
   979
				result = EFail;
sl@0
   980
				}
sl@0
   981
			
sl@0
   982
			INFO_PRINTF1(_L("EnumerateOperationPreferenceL method invocation"));	
sl@0
   983
			
sl@0
   984
			TUint operationPreferenceIndex=0;
sl@0
   985
			CCamera::CCameraAdvancedSettings::TPerformanceLevel speedLevel = 
sl@0
   986
							CCamera::CCameraAdvancedSettings::ELevelDontCare;
sl@0
   987
			CCamera::CCameraAdvancedSettings::TPerformanceLevel qualityLevel = 
sl@0
   988
							CCamera::CCameraAdvancedSettings::ELevelDontCare;
sl@0
   989
			CCamera::CCameraAdvancedSettings::TPerformanceLevel lowMemoryConsumptionLevel = 
sl@0
   990
							CCamera::CCameraAdvancedSettings::ELevelDontCare;
sl@0
   991
			CCamera::CCameraAdvancedSettings::TPerformanceLevel lowPowerConsumptionLevel = 
sl@0
   992
							CCamera::CCameraAdvancedSettings::ELevelDontCare;
sl@0
   993
			
sl@0
   994
	        TRAP(err, settings->EnumerateOperationPreferenceL(operationPreferenceIndex, speedLevel,
sl@0
   995
	        	qualityLevel, lowMemoryConsumptionLevel, lowPowerConsumptionLevel));
sl@0
   996
			if(err != KErrNotSupported)
sl@0
   997
				{
sl@0
   998
				INFO_PRINTF1(_L("EnumerateOperationPreferenceL supported!")); 
sl@0
   999
				result = EFail;
sl@0
  1000
				}
sl@0
  1001
						
sl@0
  1002
			iInputEventUid = KUidECamEventCameraSettingOperationPreference;
sl@0
  1003
			settings->SetOperationPreferenceL(operationPreferenceIndex);
sl@0
  1004
			CheckNotificationNeg(iInputEventUid, result);
sl@0
  1005
	
sl@0
  1006
			INFO_PRINTF1(_L("GetOperationPreferenceL method invocation"));
sl@0
  1007
			TInt opPreferenceIndex;
sl@0
  1008
			TRAP(err, settings->GetOperationPreferenceL(opPreferenceIndex));
sl@0
  1009
			if(err != KErrNotSupported)
sl@0
  1010
				{
sl@0
  1011
				INFO_PRINTF1(_L("GetOperationPreferenceL supported!")); 
sl@0
  1012
				result = EFail;
sl@0
  1013
				}
sl@0
  1014
			
sl@0
  1015
			INFO_PRINTF1(_L("GetSupportedEventsL method invocation"));	
sl@0
  1016
			RArray<TUid> supportedEvents;
sl@0
  1017
			settings->GetSupportedEventsL(supportedEvents);
sl@0
  1018
			
sl@0
  1019
			if(supportedEvents.Count() != 0)
sl@0
  1020
				{
sl@0
  1021
				INFO_PRINTF1(_L("GetSupportedEventsL entry exists!")); 
sl@0
  1022
				result = EFail;
sl@0
  1023
				}
sl@0
  1024
			supportedEvents.Close();
sl@0
  1025
			
sl@0
  1026
			INFO_PRINTF1(_L("GetIndirectFeatureChangesL method invocation"));	
sl@0
  1027
			RArray<TUid> featureChangesIndirect;
sl@0
  1028
			TRAP(err, settings->GetIndirectFeatureChangesL(KUidECamEventCameraSettingOperationPreference, featureChangesIndirect));
sl@0
  1029
			if(err != KErrNone)
sl@0
  1030
				{
sl@0
  1031
				INFO_PRINTF1(_L("GetIndirectFeatureChangesL returned error!")); 
sl@0
  1032
				result = EFail;
sl@0
  1033
				}
sl@0
  1034
				
sl@0
  1035
			if(featureChangesIndirect.Count() != 0)
sl@0
  1036
				{
sl@0
  1037
				INFO_PRINTF1(_L("GetIndirectFeatureChangesL entry exists!")); 
sl@0
  1038
				result = EFail;
sl@0
  1039
				}
sl@0
  1040
			featureChangesIndirect.Close();
sl@0
  1041
				
sl@0
  1042
	    	CleanupStack::PopAndDestroy(settings);
sl@0
  1043
	    	}
sl@0
  1044
	    else
sl@0
  1045
    		{
sl@0
  1046
    		result = EFail;
sl@0
  1047
    		User::Leave(KErrNoMemory);
sl@0
  1048
    		}	
sl@0
  1049
		CleanupStack::PopAndDestroy(camera);
sl@0
  1050
		}
sl@0
  1051
	else 
sl@0
  1052
		{
sl@0
  1053
		INFO_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
sl@0
  1054
		result = EFail;
sl@0
  1055
		User::Leave(KErrNoMemory);		
sl@0
  1056
		}
sl@0
  1057
	__MM_HEAP_MARKEND;
sl@0
  1058
sl@0
  1059
	return result;
sl@0
  1060
	}
sl@0
  1061
sl@0
  1062
sl@0
  1063
void RECamAdvSetDefaultsTest::TestISOTypesL(CCamera::CCameraAdvancedSettings* aSettings, CCamera::CCameraAdvancedSettings::TISORateType aIsoRateType, RArray<TInt> aSupportedIsoRates, TVerdict& aResult)
sl@0
  1064
	{
sl@0
  1065
	TInt param =0;
sl@0
  1066
	
sl@0
  1067
	switch(aIsoRateType)
sl@0
  1068
		{
sl@0
  1069
		case CCamera::CCameraAdvancedSettings::EISOManual:
sl@0
  1070
			{
sl@0
  1071
			param = KDefaultIsoRating;
sl@0
  1072
			break;	
sl@0
  1073
			}
sl@0
  1074
		
sl@0
  1075
		case CCamera::CCameraAdvancedSettings::EISOAutoISOPrioritised:
sl@0
  1076
			{
sl@0
  1077
			param = KIsoRate01;// ISO rate equal to or closest to (and less than) it should be selected by the 
sl@0
  1078
							  // camera in order to get optimum exposure.
sl@0
  1079
			break;	
sl@0
  1080
			}
sl@0
  1081
		
sl@0
  1082
		case CCamera::CCameraAdvancedSettings::EISOAutoShutterSpeedPrioritised:
sl@0
  1083
			{
sl@0
  1084
			param = KShutterSpeed;// Shutter speed equal to or closest to (and faster than) it should be selected by the 
sl@0
  1085
								  // camera in order to get optimum exposure.
sl@0
  1086
			break;	
sl@0
  1087
			}
sl@0
  1088
		
sl@0
  1089
		case CCamera::CCameraAdvancedSettings::EISOAutoAperturePrioritised:
sl@0
  1090
			{
sl@0
  1091
			param = KDefaultAperture;// Aperture opening equal to or closest to (and wider than) it should be selected by the 
sl@0
  1092
								   	 // camera in order to get optimum exposure.
sl@0
  1093
			break;	
sl@0
  1094
			}
sl@0
  1095
		
sl@0
  1096
		default:
sl@0
  1097
			{
sl@0
  1098
			param =0;
sl@0
  1099
			}
sl@0
  1100
		}
sl@0
  1101
	
sl@0
  1102
	aSettings->SetISORateL(aIsoRateType, param); 
sl@0
  1103
	
sl@0
  1104
	CheckNotification(iInputEventUid, aResult);
sl@0
  1105
	
sl@0
  1106
	CCamera::CCameraAdvancedSettings::TISORateType retrievedIsoRateType;
sl@0
  1107
	TInt retrievedParam =0;
sl@0
  1108
	TInt retrievedIsoRate =0;	
sl@0
  1109
				
sl@0
  1110
	aSettings->GetISORateL(retrievedIsoRateType, retrievedParam, retrievedIsoRate);
sl@0
  1111
	
sl@0
  1112
	if(retrievedIsoRateType != aIsoRateType)
sl@0
  1113
		{
sl@0
  1114
		INFO_PRINTF3(_L("CCameraAdvancedSettings Iso Rate Type 0x%x is not as expected 0x%x"), 
sl@0
  1115
				retrievedIsoRateType, aIsoRateType); 
sl@0
  1116
		aResult = EFail;
sl@0
  1117
		}
sl@0
  1118
	
sl@0
  1119
	if(aIsoRateType & KAutoISOTypes)
sl@0
  1120
		{
sl@0
  1121
		if(retrievedParam != param)
sl@0
  1122
			{
sl@0
  1123
			INFO_PRINTF3(_L("CCameraAdvancedSettings Auto ISO parameter %d is not as expected %d"), 
sl@0
  1124
					retrievedParam, param); 
sl@0
  1125
			aResult = EFail;
sl@0
  1126
			}
sl@0
  1127
		
sl@0
  1128
		if(retrievedIsoRate == KErrNotFound)
sl@0
  1129
			{
sl@0
  1130
			INFO_PRINTF2(_L("CCameraAdvancedSettings retrieved Iso Rate: %d :- Camera incapable of getting ISO under Auto ISO"), 
sl@0
  1131
					retrievedIsoRate); 
sl@0
  1132
			}
sl@0
  1133
		else
sl@0
  1134
			{//ISO set under Auto ISO has to be one of supported ISO rates .
sl@0
  1135
			if (aSupportedIsoRates.Find(retrievedIsoRate) == KErrNotFound)
sl@0
  1136
				{
sl@0
  1137
				INFO_PRINTF2(_L("CCameraAdvancedSettings Iso Rate %d is not among the supported ISO rates"), 
sl@0
  1138
						retrievedIsoRate); 
sl@0
  1139
				aResult = EFail;
sl@0
  1140
				}
sl@0
  1141
			
sl@0
  1142
			
sl@0
  1143
			if(aIsoRateType == CCamera::CCameraAdvancedSettings::EISOAutoISOPrioritised)
sl@0
  1144
				{
sl@0
  1145
				//ISO rate set should be less than or equal to param
sl@0
  1146
				if (retrievedIsoRate > param)
sl@0
  1147
					{
sl@0
  1148
					INFO_PRINTF3(_L("CCameraAdvancedSettings Iso Rate %d is greater than %d"), 
sl@0
  1149
	    					retrievedIsoRate, param); 
sl@0
  1150
	    			aResult = EFail;
sl@0
  1151
					}
sl@0
  1152
				}
sl@0
  1153
			
sl@0
  1154
			//use of old API
sl@0
  1155
			TInt retrievedIsoRateOld = aSettings->IsoRate();
sl@0
  1156
			if (retrievedIsoRateOld != retrievedIsoRate)
sl@0
  1157
				{
sl@0
  1158
				INFO_PRINTF3(_L("CCameraAdvancedSettings OLD and NEW API inconsistent: Iso Rate old %d ; ISO Rate new: %d"), 
sl@0
  1159
						retrievedIsoRateOld, retrievedIsoRate); 
sl@0
  1160
				aResult = EFail;
sl@0
  1161
				}	
sl@0
  1162
			}
sl@0
  1163
		
sl@0
  1164
		//switch to manual ISO using OLD API
sl@0
  1165
		aSettings->SetIsoRate(KDefaultIsoRating);
sl@0
  1166
		
sl@0
  1167
		aSettings->GetISORateL(retrievedIsoRateType, param, retrievedIsoRate);
sl@0
  1168
		
sl@0
  1169
		if(retrievedIsoRateType != CCamera::CCameraAdvancedSettings::EISOManual)
sl@0
  1170
			{
sl@0
  1171
			INFO_PRINTF3(_L("CCameraAdvancedSettings Iso Rate Type 0x%x is not as expected 0x%x : OLD and NEW API inconsistent"), 
sl@0
  1172
					retrievedIsoRateType, CCamera::CCameraAdvancedSettings::EISOManual); 
sl@0
  1173
			aResult = EFail;
sl@0
  1174
			}
sl@0
  1175
	
sl@0
  1176
		if (retrievedIsoRate != KDefaultIsoRating)
sl@0
  1177
			{
sl@0
  1178
			INFO_PRINTF3(_L("CCameraAdvancedSettings Iso Rate %d is not as expected %d"), 
sl@0
  1179
					retrievedIsoRate, KDefaultIsoRating); 
sl@0
  1180
			aResult = EFail;
sl@0
  1181
			}
sl@0
  1182
		}
sl@0
  1183
	
sl@0
  1184
	//use of old API
sl@0
  1185
	TInt retrievedIsoRateOld = aSettings->IsoRate();
sl@0
  1186
	if (retrievedIsoRateOld != retrievedIsoRate)
sl@0
  1187
		{
sl@0
  1188
		INFO_PRINTF3(_L("CCameraAdvancedSettings OLD and NEW API inconsistent: Iso Rate old %d ; ISO Rate new: %d"), 
sl@0
  1189
				retrievedIsoRateOld, retrievedIsoRate); 
sl@0
  1190
		aResult = EFail;
sl@0
  1191
		}
sl@0
  1192
	}
sl@0
  1193
sl@0
  1194
//
sl@0
  1195
// RECamAdvSetGettersTest //
sl@0
  1196
//	
sl@0
  1197
RECamAdvSetGettersTest* RECamAdvSetGettersTest::NewL(TBool aAllocTest)
sl@0
  1198
	{
sl@0
  1199
	RECamAdvSetGettersTest* self = new (ELeave) RECamAdvSetGettersTest(aAllocTest);
sl@0
  1200
	return self;	
sl@0
  1201
	}
sl@0
  1202
	
sl@0
  1203
RECamAdvSetGettersTest::RECamAdvSetGettersTest(TBool /*aAllocTest*/)
sl@0
  1204
	{
sl@0
  1205
	iTestStepName = _L("MM-ECM-ADV-U-011-HP");
sl@0
  1206
	}
sl@0
  1207
	
sl@0
  1208
TVerdict RECamAdvSetGettersTest::DoTestStepL()
sl@0
  1209
	{	
sl@0
  1210
	TVerdict result = EPass;
sl@0
  1211
	CCamera* camera = NULL;
sl@0
  1212
sl@0
  1213
	TInt error = KErrNone;
sl@0
  1214
	CCamera::CCameraAdvancedSettings* settings = NULL;
sl@0
  1215
		
sl@0
  1216
	__MM_HEAP_MARK;
sl@0
  1217
	INFO_PRINTF1(_L("Create camera using Camera::New2L() and MCameraObserver2"));
sl@0
  1218
	TRAP(error, camera = CCamera::New2L(*this, 0,0));
sl@0
  1219
	
sl@0
  1220
	if (error==KErrNone)
sl@0
  1221
		{
sl@0
  1222
		CleanupStack::PushL(camera);
sl@0
  1223
		INFO_PRINTF1(_L("Create advanced settings from CCamera object"));
sl@0
  1224
		settings = 	static_cast<CCamera::CCameraAdvancedSettings*> (camera->CustomInterface(KECamAdvancedSettingUid));
sl@0
  1225
	    if (settings!= NULL)
sl@0
  1226
	    	{
sl@0
  1227
	    	CleanupStack::PushL(settings);
sl@0
  1228
	   
sl@0
  1229
     	    iInputEventUid = KUidECamEventCameraSettingIsoRate;
sl@0
  1230
	    	TInt isoRateSet = KIsoRate01;
sl@0
  1231
	    	settings->SetIsoRate(isoRateSet);    
sl@0
  1232
	    	INFO_PRINTF2(_L("CCameraAdvancedSettings Iso Rate set %d"), isoRateSet); 	    		
sl@0
  1233
sl@0
  1234
	        CheckNotification(iInputEventUid, result);
sl@0
  1235
	        	                
sl@0
  1236
			// Get ISO rate. It should have changed to set value.
sl@0
  1237
	    	TInt isoRate = settings->IsoRate();
sl@0
  1238
	    	INFO_PRINTF2(_L("CCameraAdvancedSettings get Iso Rate %d"), isoRate); 
sl@0
  1239
	    		    		
sl@0
  1240
	    	if (isoRateSet!=isoRate) 
sl@0
  1241
	    		{
sl@0
  1242
	    		INFO_PRINTF1(_L("Got a different iso rate than it was set"));
sl@0
  1243
	    		result = EFail;
sl@0
  1244
	    		}
sl@0
  1245
 
sl@0
  1246
	    	CleanupStack::PopAndDestroy(settings);
sl@0
  1247
	    	}
sl@0
  1248
	    else
sl@0
  1249
    		{
sl@0
  1250
    		result = EFail;
sl@0
  1251
    		}	
sl@0
  1252
		CleanupStack::PopAndDestroy(camera);
sl@0
  1253
		}
sl@0
  1254
	else 
sl@0
  1255
		{
sl@0
  1256
		INFO_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
sl@0
  1257
		result = EFail;		
sl@0
  1258
		}
sl@0
  1259
	__MM_HEAP_MARKEND;
sl@0
  1260
sl@0
  1261
	return result;
sl@0
  1262
	}
sl@0
  1263
sl@0
  1264
sl@0
  1265
//
sl@0
  1266
// RECamAdvSetTwoCamTest //
sl@0
  1267
//
sl@0
  1268
RECamAdvSetTwoCamTest* RECamAdvSetTwoCamTest::NewL(TBool aAllocTest)
sl@0
  1269
	{
sl@0
  1270
	RECamAdvSetTwoCamTest* self = new (ELeave) RECamAdvSetTwoCamTest(aAllocTest);
sl@0
  1271
	return self;	
sl@0
  1272
	}
sl@0
  1273
	
sl@0
  1274
RECamAdvSetTwoCamTest::RECamAdvSetTwoCamTest(TBool /*aAllocTest*/)
sl@0
  1275
	{
sl@0
  1276
	iTestStepName = _L("MM-ECM-ADV-U-014-HP");
sl@0
  1277
	}
sl@0
  1278
	
sl@0
  1279
TVerdict RECamAdvSetTwoCamTest::DoTestStepL()
sl@0
  1280
	{	
sl@0
  1281
	TVerdict result = EPass;
sl@0
  1282
	CCamera* camera1 = NULL;
sl@0
  1283
	CCamera* camera2 = NULL;
sl@0
  1284
	
sl@0
  1285
	TInt error = KErrNone;
sl@0
  1286
	CCamera::CCameraAdvancedSettings* settings1 = NULL;
sl@0
  1287
	CCamera::CCameraAdvancedSettings* settings2 = NULL;		
sl@0
  1288
	
sl@0
  1289
	// using observer 2 if exist 
sl@0
  1290
	MCameraObserver2* observer2 = NULL; 
sl@0
  1291
	
sl@0
  1292
	__MM_HEAP_MARK;
sl@0
  1293
	INFO_PRINTF1(_L("Create camera using Camera::New2L() and MCameraObserver2"));
sl@0
  1294
	TRAP(error, camera1 = CCamera::New2L(*this, 0,0));
sl@0
  1295
	if (error==KErrNone)
sl@0
  1296
		{
sl@0
  1297
		CleanupStack::PushL(camera1);
sl@0
  1298
		TRAP(error, camera2 = CCamera::New2L(*observer2, 1,0));
sl@0
  1299
sl@0
  1300
		if (error==KErrNone)
sl@0
  1301
			{
sl@0
  1302
			CleanupStack::PushL(camera2);
sl@0
  1303
		    //Second camera
sl@0
  1304
			settings1 = static_cast<CCamera::CCameraAdvancedSettings*> (camera1->CustomInterface(KECamAdvancedSettingUid));
sl@0
  1305
	    	RArray<TUid> aSuppSettings1;
sl@0
  1306
	    	RArray<TUid> aActSettings1;
sl@0
  1307
	    	if (settings1!= NULL)
sl@0
  1308
		    	{
sl@0
  1309
		    	CleanupStack::PushL(settings1);
sl@0
  1310
		    	
sl@0
  1311
				CleanupClosePushL(aSuppSettings1);	 
sl@0
  1312
				aSuppSettings1.Reset();   
sl@0
  1313
			    settings1->GetSupportedSettingsL(aSuppSettings1);
sl@0
  1314
				CleanupClosePushL(aActSettings1);	 
sl@0
  1315
				aActSettings1.Reset();   
sl@0
  1316
			    settings1->GetActiveSettingsL(aActSettings1);
sl@0
  1317
				if ((aActSettings1.Count())==0)
sl@0
  1318
					{
sl@0
  1319
	   				INFO_PRINTF1(_L("Active camera. Non empty array expected")); 
sl@0
  1320
	        		result = EFail;						
sl@0
  1321
					}
sl@0
  1322
					
sl@0
  1323
				settings1->GetDisabledSettingsL(aActSettings1);
sl@0
  1324
				}
sl@0
  1325
		    	
sl@0
  1326
		    //Second camera
sl@0
  1327
			settings2 = static_cast<CCamera::CCameraAdvancedSettings*> (camera2->CustomInterface(KECamAdvancedSettingUid));
sl@0
  1328
	    	RArray<TUid> aSuppSettings2;
sl@0
  1329
	    	RArray<TUid> aActSettings2;
sl@0
  1330
	    	if (settings2!= NULL)
sl@0
  1331
		    	{
sl@0
  1332
		    	CleanupStack::PushL(settings2);
sl@0
  1333
sl@0
  1334
				CleanupClosePushL(aSuppSettings2);	 
sl@0
  1335
				aSuppSettings2.Reset();   
sl@0
  1336
	    		settings2->GetSupportedSettingsL(aSuppSettings2);
sl@0
  1337
				CleanupClosePushL(aActSettings2);	 
sl@0
  1338
				aActSettings2.Reset();   
sl@0
  1339
		    	settings2->GetActiveSettingsL(aActSettings2);  	
sl@0
  1340
				if ((aActSettings2.Count())!=0)
sl@0
  1341
					{
sl@0
  1342
 					INFO_PRINTF1(_L("Empty array expected (non present camera)")); 
sl@0
  1343
	       			result = EFail;						
sl@0
  1344
					}
sl@0
  1345
				}		
sl@0
  1346
	    	
sl@0
  1347
	    	CleanupStack::PopAndDestroy(2, &aSuppSettings2); //aActSettings2
sl@0
  1348
			CleanupStack::PopAndDestroy(settings2);	
sl@0
  1349
			
sl@0
  1350
			CleanupStack::PopAndDestroy(2, &aSuppSettings1); //aActSettings1
sl@0
  1351
			CleanupStack::PopAndDestroy(settings1);			
sl@0
  1352
sl@0
  1353
			CleanupStack::PopAndDestroy(camera2);
sl@0
  1354
			
sl@0
  1355
			}
sl@0
  1356
		else 
sl@0
  1357
			{
sl@0
  1358
			INFO_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
sl@0
  1359
			result = EFail;		
sl@0
  1360
			}
sl@0
  1361
sl@0
  1362
		CleanupStack::PopAndDestroy(camera1);
sl@0
  1363
sl@0
  1364
		}
sl@0
  1365
	else 
sl@0
  1366
		{
sl@0
  1367
		INFO_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
sl@0
  1368
		result = EFail;		
sl@0
  1369
		}
sl@0
  1370
	__MM_HEAP_MARKEND;
sl@0
  1371
sl@0
  1372
	return result;
sl@0
  1373
	}
sl@0
  1374
	
sl@0
  1375
//
sl@0
  1376
// RECamAdvSetNegTest //
sl@0
  1377
//
sl@0
  1378
sl@0
  1379
RECamAdvSetNegTest* RECamAdvSetNegTest::NewL(TBool aAllocTest)
sl@0
  1380
	{
sl@0
  1381
	RECamAdvSetNegTest* self = new (ELeave) RECamAdvSetNegTest(aAllocTest);
sl@0
  1382
	return self;	
sl@0
  1383
	}
sl@0
  1384
	
sl@0
  1385
RECamAdvSetNegTest::RECamAdvSetNegTest(TBool /*aAllocTest*/)
sl@0
  1386
	{
sl@0
  1387
	iTestStepName = _L("MM-ECM-ADV-U-0102-HP");
sl@0
  1388
	}
sl@0
  1389
	
sl@0
  1390
TVerdict RECamAdvSetNegTest::DoTestStepL()
sl@0
  1391
	{	
sl@0
  1392
	TVerdict result = EPass;
sl@0
  1393
	CCamera* camera = NULL;
sl@0
  1394
sl@0
  1395
	TInt error = KErrNone;
sl@0
  1396
	CCamera::CCameraAdvancedSettings* settings = NULL;
sl@0
  1397
	
sl@0
  1398
	__MM_HEAP_MARK;
sl@0
  1399
	INFO_PRINTF1(_L("Create camera using Camera::New2L() and MCameraObserver2"));
sl@0
  1400
	TRAP(error, camera = CCamera::New2L(*this,0,0));
sl@0
  1401
	
sl@0
  1402
	if (error==KErrNone)
sl@0
  1403
		{
sl@0
  1404
		CleanupStack::PushL(camera);
sl@0
  1405
		INFO_PRINTF1(_L("Create advanced settings from CCamera object"));
sl@0
  1406
		settings = 	static_cast<CCamera::CCameraAdvancedSettings*> (camera->CustomInterface(KECamAdvancedSettingUid));
sl@0
  1407
	    if (settings!= NULL)
sl@0
  1408
	    	{
sl@0
  1409
	    	CleanupStack::PushL(settings);
sl@0
  1410
	    	// trying to set a value which is not supported
sl@0
  1411
	    	// the action would fail to set a new value and the notification will fail
sl@0
  1412
	    	// thus the current value will be different from the requested value. - double verification
sl@0
  1413
     	    iInputEventUid = KUidECamEventCameraSettingIsoRate;
sl@0
  1414
	    	TInt isoRateSet = KIsoRate0; // not supported rate
sl@0
  1415
	    	settings->SetIsoRate(isoRateSet);    
sl@0
  1416
	    	INFO_PRINTF2(_L("CCameraAdvancedSettings Iso Rate set 0x%x"), isoRateSet); 	    		
sl@0
  1417
sl@0
  1418
	        CheckNotificationNeg(iInputEventUid, result);
sl@0
  1419
	        	                
sl@0
  1420
			// Get ISO rate. It should have changed to set value.
sl@0
  1421
	    	TInt isoRate = settings->IsoRate();
sl@0
  1422
	    	INFO_PRINTF2(_L("CCameraAdvancedSettings get Iso Rate 0x%x"), isoRate); 	    		
sl@0
  1423
	    	if (isoRateSet == isoRate) 
sl@0
  1424
	    		{
sl@0
  1425
	    		INFO_PRINTF1(_L("Got an unsupported iso rate set"));
sl@0
  1426
	    		result = EFail;
sl@0
  1427
	    		}
sl@0
  1428
 			
sl@0
  1429
 			// Check the new API for ISO setting as well.
sl@0
  1430
 			iInputEventUid = KUidECamEventCameraSettingIsoRateType;
sl@0
  1431
	    	
sl@0
  1432
	    	settings->SetISORateL(CCamera::CCameraAdvancedSettings::EISOManual, isoRateSet);    
sl@0
  1433
	    	INFO_PRINTF2(_L("CCameraAdvancedSettings Iso Rate set 0x%x"), isoRateSet); 	    		
sl@0
  1434
sl@0
  1435
	        CheckNotificationNeg(iInputEventUid, result);
sl@0
  1436
	        	                
sl@0
  1437
			// Get ISO rate. It should have changed to set value.
sl@0
  1438
	    	CCamera::CCameraAdvancedSettings::TISORateType isoRateType = CCamera::CCameraAdvancedSettings::EISOManual;
sl@0
  1439
	    	TInt index =0;
sl@0
  1440
	    	settings->GetISORateL(isoRateType, index, isoRate);
sl@0
  1441
	    	INFO_PRINTF2(_L("CCameraAdvancedSettings get Iso Rate 0x%x"), isoRate); 	    		
sl@0
  1442
	    	if (isoRateSet == isoRate) 
sl@0
  1443
	    		{
sl@0
  1444
	    		INFO_PRINTF1(_L("Got an unsupported iso rate set"));
sl@0
  1445
	    		result = EFail;
sl@0
  1446
	    		}
sl@0
  1447
 			
sl@0
  1448
	    	CleanupStack::PopAndDestroy(settings);
sl@0
  1449
	    	}
sl@0
  1450
	    else
sl@0
  1451
    		{
sl@0
  1452
    		result = EFail;
sl@0
  1453
    		}	
sl@0
  1454
		CleanupStack::PopAndDestroy(camera);
sl@0
  1455
		}
sl@0
  1456
	else 
sl@0
  1457
		{
sl@0
  1458
		INFO_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
sl@0
  1459
		result = EFail;		
sl@0
  1460
		}
sl@0
  1461
	__MM_HEAP_MARKEND;
sl@0
  1462
sl@0
  1463
	return result;
sl@0
  1464
	}
sl@0
  1465
		
sl@0
  1466
//
sl@0
  1467
// RECamAdvSetBaselineTest //
sl@0
  1468
//
sl@0
  1469
RECamAdvSetBaselineTest* RECamAdvSetBaselineTest::NewL(TBool aAllocTest)
sl@0
  1470
	{
sl@0
  1471
	RECamAdvSetBaselineTest* self = new (ELeave) RECamAdvSetBaselineTest(aAllocTest);
sl@0
  1472
	return self;	
sl@0
  1473
	}
sl@0
  1474
sl@0
  1475
RECamAdvSetBaselineTest::RECamAdvSetBaselineTest(TBool)
sl@0
  1476
	{
sl@0
  1477
	iTestStepName = _L("MM-ECM-ADV-U-048-HP");
sl@0
  1478
	}
sl@0
  1479
	
sl@0
  1480
TVerdict RECamAdvSetBaselineTest::DoTestStepL()
sl@0
  1481
	{	
sl@0
  1482
	TVerdict result = EPass;
sl@0
  1483
	CCamera* camera = NULL;
sl@0
  1484
sl@0
  1485
	TInt error = KErrNone;
sl@0
  1486
	CCamera::CCameraAdvancedSettings* settings = NULL;
sl@0
  1487
	
sl@0
  1488
	__MM_HEAP_MARK;
sl@0
  1489
	INFO_PRINTF1(_L("Create camera using Camera::NewL() and MCameraObserver2"));
sl@0
  1490
	TRAP(error, camera = CCamera::NewL(*this, 0,0));
sl@0
  1491
	if (error==KErrNone)
sl@0
  1492
		{
sl@0
  1493
		CleanupStack::PushL(camera);
sl@0
  1494
		INFO_PRINTF1(_L("Create advanced settings from CCamera object"));
sl@0
  1495
		settings = 	static_cast<CCamera::CCameraAdvancedSettings*> (camera->CustomInterface(KECamAdvancedSettingUid));
sl@0
  1496
	    if (settings!= NULL)
sl@0
  1497
	    	{
sl@0
  1498
	    	CleanupStack::PushL(settings);
sl@0
  1499
	    	
sl@0
  1500
	    	// Supported Focus Range. Set unfamilar Focus Range. Get a known Focus Range.
sl@0
  1501
			iInputEventUid = KUidECamEventCameraSettingFocusRange;	    	
sl@0
  1502
	    	TInt suppFocusRanges = settings->SupportedFocusRanges();    	
sl@0
  1503
	    	INFO_PRINTF2(_L("CCameraAdvancedSettings supported Focus Ranges 0x%x"), suppFocusRanges); 
sl@0
  1504
	    	if(suppFocusRanges > KBaselinedFocusRanges)
sl@0
  1505
	    		{
sl@0
  1506
	    		INFO_PRINTF1(_L("Unfamiliar focus range received")); 
sl@0
  1507
	    		result = EFail;
sl@0
  1508
	    		}
sl@0
  1509
	    		
sl@0
  1510
	    	CCamera::CCameraAdvancedSettings::TFocusRange unfamilarFocusRange = CCamera::CCameraAdvancedSettings::EFocusRangeHyperfocal;
sl@0
  1511
			settings->SetFocusRange(unfamilarFocusRange);
sl@0
  1512
			
sl@0
  1513
			// Check for KUidECamEventCameraSettingFocusRange.
sl@0
  1514
	        CheckNotification(iInputEventUid, result);
sl@0
  1515
sl@0
  1516
	    	CCamera::CCameraAdvancedSettings::TFocusRange retrievedFocusRange = settings->FocusRange();
sl@0
  1517
	    	if (CCamera::CCameraAdvancedSettings::EFocusRangeAuto != retrievedFocusRange) 
sl@0
  1518
	    		{
sl@0
  1519
	   		 	INFO_PRINTF1(_L("CCameraAdvancedSettings retrieved unfamilar/wrong Focus Range")); 
sl@0
  1520
	    		result = EFail;
sl@0
  1521
	    		}
sl@0
  1522
	    		
sl@0
  1523
	        // Supported White Balance Modes. Set unfamilar White Balance. Get a known White Balance.
sl@0
  1524
			iInputEventUid = KUidECamEventCameraSettingsWBValue;	    	
sl@0
  1525
	    	TInt suppWhiteBalance = settings->SupportedWhiteBalanceModes();    	
sl@0
  1526
	    	INFO_PRINTF2(_L("CCameraAdvancedSettings supported White Balance 0x%x"), suppWhiteBalance); 
sl@0
  1527
	    	if(suppWhiteBalance > KBaselinedWhiteBalanceModes)
sl@0
  1528
	    		{
sl@0
  1529
	    		INFO_PRINTF1(_L("Unfamiliar White Balance received")); 
sl@0
  1530
	    		result = EFail;
sl@0
  1531
	    		}
sl@0
  1532
	    		
sl@0
  1533
	    	CCamera::TWhiteBalance unfamilarWhiteBalance = CCamera::EWBDaylightUnderWater;
sl@0
  1534
			settings->SetWhiteBalanceMode(unfamilarWhiteBalance);
sl@0
  1535
			
sl@0
  1536
			// Check for KUidECamEventCameraSettingsWBValue.
sl@0
  1537
	        CheckNotification(iInputEventUid, result);
sl@0
  1538
sl@0
  1539
	    	CCamera::TWhiteBalance retrievedWhiteBalance = settings->WhiteBalanceMode();
sl@0
  1540
	    	if (CCamera::EWBAuto != retrievedWhiteBalance) 
sl@0
  1541
	    		{
sl@0
  1542
	   		 	INFO_PRINTF1(_L("CCameraAdvancedSettings retrieved unfamilar/wrong WhiteBalance")); 
sl@0
  1543
	    		result = EFail;
sl@0
  1544
	    		}
sl@0
  1545
			
sl@0
  1546
			RArray<TUid> settingsList; 
sl@0
  1547
	    	CleanupClosePushL(settingsList);
sl@0
  1548
	    	// check for GetSupportedSettings
sl@0
  1549
	    	settings->GetSupportedSettingsL(settingsList);
sl@0
  1550
	    	
sl@0
  1551
	    	for(TInt index=0; index<settingsList.Count(); index++)
sl@0
  1552
	    		{
sl@0
  1553
	    		if(settingsList[index].iUid > KUidECamEventCameraSettingAutoFocusType2UidValue)
sl@0
  1554
	    			{
sl@0
  1555
	    			INFO_PRINTF1(_L("CCameraAdvancedSettings retrieved unfamilar settings")); 
sl@0
  1556
	    			result = EFail;
sl@0
  1557
	    			}
sl@0
  1558
	    		}
sl@0
  1559
	    	settingsList.Reset();
sl@0
  1560
	    	
sl@0
  1561
	    	// check for GetActiveSettings
sl@0
  1562
	    	settings->GetActiveSettingsL(settingsList);
sl@0
  1563
	    	
sl@0
  1564
	    	for(TInt index=0; index<settingsList.Count(); index++)
sl@0
  1565
	    		{
sl@0
  1566
	    		if(settingsList[index].iUid > KUidECamEventCameraSettingAutoFocusType2UidValue)
sl@0
  1567
	    			{
sl@0
  1568
	    			INFO_PRINTF1(_L("CCameraAdvancedSettings retrieved unfamilar settings")); 
sl@0
  1569
	    			result = EFail;
sl@0
  1570
	    			}
sl@0
  1571
	    		}
sl@0
  1572
	    	settingsList.Reset();
sl@0
  1573
	    	
sl@0
  1574
	    	// check for GetDisabledSettings
sl@0
  1575
	    	settings->GetDisabledSettingsL(settingsList);
sl@0
  1576
	    	
sl@0
  1577
	    	for(TInt index=0; index<settingsList.Count(); index++)
sl@0
  1578
	    		{
sl@0
  1579
	    		if(settingsList[index].iUid > KUidECamEventCameraSettingAutoFocusType2UidValue)
sl@0
  1580
	    			{
sl@0
  1581
	    			INFO_PRINTF1(_L("CCameraAdvancedSettings retrieved unfamilar settings")); 
sl@0
  1582
	    			result = EFail;
sl@0
  1583
	    			}
sl@0
  1584
	    		}
sl@0
  1585
	    	settingsList.Reset();
sl@0
  1586
	    	
sl@0
  1587
	    	// check for PRECaptureWarning
sl@0
  1588
	    	TInt preCaptureWarningSupported = KAllPreCaptureWarnings; // ( = 0x3FFF)	
sl@0
  1589
	    	settings->GetPreCaptureWarningSupportedL(CCamera::CCameraAdvancedSettings::EModeIdle, preCaptureWarningSupported);	
sl@0
  1590
	    	if(preCaptureWarningSupported != ((CCamera::CCameraAdvancedSettings::EPCWGeneralWarning << 1)-1))
sl@0
  1591
	    		{
sl@0
  1592
	    		INFO_PRINTF1(_L("CCameraAdvancedSettings retrieved unfamilar preCaptureWarningSupported")); 
sl@0
  1593
	    		result = EFail;
sl@0
  1594
	    		}
sl@0
  1595
	    	
sl@0
  1596
	    	// subscribe for pre capture warnings. Poll for it. Unsubscribe for Pre capture warning.
sl@0
  1597
	    	settings->SubscribeToPreCaptureWarningL(preCaptureWarningSupported);
sl@0
  1598
	    	
sl@0
  1599
	    	//Poll to know the status of every possible warning ...
sl@0
  1600
	    	TInt warningStatus = preCaptureWarningSupported;
sl@0
  1601
	    	settings->GetPreCaptureWarningL(warningStatus);
sl@0
  1602
	    	if(warningStatus != ((CCamera::CCameraAdvancedSettings::EPCWGeneralWarning << 1)-1))
sl@0
  1603
	    		{
sl@0
  1604
	    		INFO_PRINTF1(_L("CCameraAdvancedSettings retrieved unfamilar PreCaptureWarning")); 
sl@0
  1605
	    		result = EFail;
sl@0
  1606
	    		}
sl@0
  1607
	    		
sl@0
  1608
	    	settings->UnSubscribePreCaptureWarningL();
sl@0
  1609
	    	
sl@0
  1610
			CleanupStack::PopAndDestroy(&settingsList);
sl@0
  1611
	    	CleanupStack::PopAndDestroy(settings);
sl@0
  1612
	    	}
sl@0
  1613
	    else
sl@0
  1614
    		{
sl@0
  1615
    		result = EFail;
sl@0
  1616
    		}	
sl@0
  1617
		CleanupStack::PopAndDestroy(camera);
sl@0
  1618
		}
sl@0
  1619
	else 
sl@0
  1620
		{
sl@0
  1621
		INFO_PRINTF2(_L("Unexpected %d return from CCamera::NewL(): observer 2"), error);
sl@0
  1622
		result = EFail;		
sl@0
  1623
		}
sl@0
  1624
	__MM_HEAP_MARKEND;
sl@0
  1625
sl@0
  1626
	return result;
sl@0
  1627
	}
sl@0
  1628
sl@0
  1629
class TDummyObserver: public MCameraObserver2
sl@0
  1630
    {
sl@0
  1631
public:
sl@0
  1632
    explicit TDummyObserver(TInt& aErrorPointer);
sl@0
  1633
sl@0
  1634
    virtual void HandleEvent(const TECAMEvent& aEvent);
sl@0
  1635
    virtual void ViewFinderReady(MCameraBuffer& aCameraBuffer,TInt aError);
sl@0
  1636
    virtual void ImageBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
sl@0
  1637
    virtual void VideoBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
sl@0
  1638
    
sl@0
  1639
private:
sl@0
  1640
    TInt& iErrorPointer;
sl@0
  1641
    };
sl@0
  1642
    
sl@0
  1643
TDummyObserver::TDummyObserver(TInt& aErrorPointer):iErrorPointer(aErrorPointer)
sl@0
  1644
    {
sl@0
  1645
    }
sl@0
  1646
sl@0
  1647
void TDummyObserver::HandleEvent(const TECAMEvent& /*aEvent*/)
sl@0
  1648
    {
sl@0
  1649
    return;
sl@0
  1650
    }
sl@0
  1651
   
sl@0
  1652
void TDummyObserver::ViewFinderReady(MCameraBuffer& /*aCameraBuffer*/, TInt aError)
sl@0
  1653
    {
sl@0
  1654
    iErrorPointer = aError;
sl@0
  1655
    }
sl@0
  1656
       
sl@0
  1657
void TDummyObserver::ImageBufferReady(MCameraBuffer& /*aCameraBuffer*/, TInt aError)
sl@0
  1658
    {
sl@0
  1659
    iErrorPointer = aError;
sl@0
  1660
    }
sl@0
  1661
       
sl@0
  1662
void TDummyObserver::VideoBufferReady(MCameraBuffer& /*aCameraBuffer*/,TInt aError)
sl@0
  1663
    {
sl@0
  1664
    iErrorPointer = aError;
sl@0
  1665
    }
sl@0
  1666
sl@0
  1667
RECamAdvSetTest2* RECamAdvSetTest2::NewL(TBool aAllocTest)
sl@0
  1668
	{
sl@0
  1669
	RECamAdvSetTest2* self = new (ELeave) RECamAdvSetTest2(aAllocTest);
sl@0
  1670
	return self;	
sl@0
  1671
	}
sl@0
  1672
	
sl@0
  1673
RECamAdvSetTest2::RECamAdvSetTest2(TBool /*aAllocTest*/)
sl@0
  1674
	{
sl@0
  1675
	iTestStepName = _L("MM-ECM-ADV-U-049-HP");
sl@0
  1676
	}
sl@0
  1677
	
sl@0
  1678
void RECamAdvSetTest2::RatioSubStepL(CCamera::CCameraAdvancedSettings* settings, TInt aSuppRange, TInt aTestValue, TInt aExpValue)
sl@0
  1679
    {
sl@0
  1680
// Pixel ratio's //    
sl@0
  1681
    TInt suppRatios = settings->SupportedPixelAspectRatios();
sl@0
  1682
    if (suppRatios != aSuppRange)
sl@0
  1683
        {
sl@0
  1684
    	INFO_PRINTF2(_L("--Error: Supported pixel ratios are wrong %x "), suppRatios);
sl@0
  1685
    	User::Leave(KErrGeneral);        
sl@0
  1686
        }
sl@0
  1687
    settings->SetPixelAspectRatio( CCamera::CCameraAdvancedSettings::TPixelAspectRatio(aTestValue) );
sl@0
  1688
    
sl@0
  1689
    TInt ratio = settings->PixelAspectRatio();
sl@0
  1690
    
sl@0
  1691
    if (ratio != aExpValue)
sl@0
  1692
        {
sl@0
  1693
    	INFO_PRINTF2(_L("--Error: Returned ration is wrong %x "), ratio);
sl@0
  1694
    	User::Leave(KErrGeneral);                
sl@0
  1695
        }    
sl@0
  1696
    }
sl@0
  1697
    
sl@0
  1698
void RECamAdvSetTest2::FlashSubStepL(CCamera::CCameraAdvancedSettings* settings, TInt aSuppRange, TInt aTestValue, TInt aExpValue)
sl@0
  1699
    {
sl@0
  1700
// Flash modes //
sl@0
  1701
    TInt suppFlashModes = settings->SupportedFlashModes();
sl@0
  1702
        
sl@0
  1703
    if (suppFlashModes != aSuppRange)
sl@0
  1704
        {
sl@0
  1705
    	INFO_PRINTF2(_L("--Error: Supported flash modes are wrong %x "), suppFlashModes);
sl@0
  1706
    	User::Leave(KErrGeneral);        
sl@0
  1707
        }
sl@0
  1708
    settings->SetFlashMode( CCamera::TFlash(aTestValue) );
sl@0
  1709
    
sl@0
  1710
    TInt flashMode = settings->FlashMode();
sl@0
  1711
    
sl@0
  1712
    if (flashMode != aExpValue)
sl@0
  1713
        {
sl@0
  1714
    	INFO_PRINTF2(_L("--Error: Returned flash mode is wrong %x "), flashMode);
sl@0
  1715
    	User::Leave(KErrGeneral);                
sl@0
  1716
        }    
sl@0
  1717
    }
sl@0
  1718
    
sl@0
  1719
void RECamAdvSetTest2::OvrSubStepL(CCamera& aCamera, TInt aSuppRange, TInt aTestValue, TInt aExpValue)
sl@0
  1720
    {
sl@0
  1721
    // Overlay modes //
sl@0
  1722
    CCamera::CCameraOverlay* overlay = NULL;
sl@0
  1723
    TInt error = KErrNone;
sl@0
  1724
    TRAP(error, overlay = CCamera::CCameraOverlay::NewL(aCamera));
sl@0
  1725
sl@0
  1726
    if (overlay == NULL)
sl@0
  1727
        {
sl@0
  1728
    	INFO_PRINTF1(_L("--Error: Failed to get the CCameraOverlay"));
sl@0
  1729
    	User::Leave(KErrGeneral);        
sl@0
  1730
        }
sl@0
  1731
    CleanupStack::PushL(overlay);
sl@0
  1732
    CCamera::CCameraOverlay::TOverlaySupportInfo overlaySupInfo;
sl@0
  1733
    overlay->GetOverlaySupport( overlaySupInfo );
sl@0
  1734
    
sl@0
  1735
    if (overlaySupInfo.iSupportedModes != aSuppRange)
sl@0
  1736
        {
sl@0
  1737
    	INFO_PRINTF2(_L("--Error: Supported overlay modes are wrong %x "), overlaySupInfo.iSupportedModes);
sl@0
  1738
    	User::Leave(KErrGeneral);        
sl@0
  1739
        }
sl@0
  1740
sl@0
  1741
    CCamera::CCameraOverlay::TOverlayParameters ovrParams;
sl@0
  1742
    ovrParams.iCurrentModes = aTestValue;
sl@0
  1743
    ovrParams.iCurrentTypes = CCamera::CCameraOverlay::EPerPixel;
sl@0
  1744
    
sl@0
  1745
    CFbsBitmap* bmp = new (ELeave) CFbsBitmap();
sl@0
  1746
    CleanupStack::PushL(bmp);
sl@0
  1747
    TUint handle = 0;
sl@0
  1748
    TRAP(error, handle = overlay->CreateOverlayL(ovrParams, bmp) );
sl@0
  1749
    if (error != KErrNone)
sl@0
  1750
        {
sl@0
  1751
    	INFO_PRINTF2(_L("--Error: failed to create overlay %d "), error);
sl@0
  1752
    	User::Leave(KErrGeneral);                
sl@0
  1753
        }
sl@0
  1754
        
sl@0
  1755
    CCamera::CCameraOverlay::TOverlayParameters retrievedParams;
sl@0
  1756
    overlay->GetOverlayParametersL(handle, retrievedParams);
sl@0
  1757
    overlay->ReleaseOverlay(handle);
sl@0
  1758
    
sl@0
  1759
    if (retrievedParams.iCurrentModes != aExpValue)
sl@0
  1760
        {
sl@0
  1761
    	INFO_PRINTF2(_L("--Error: wrong overlay params retrieved %x "), retrievedParams.iCurrentModes);
sl@0
  1762
    	User::Leave(KErrGeneral);        
sl@0
  1763
        }
sl@0
  1764
    CleanupStack::PopAndDestroy(2, overlay); 
sl@0
  1765
    }
sl@0
  1766
sl@0
  1767
TVerdict RECamAdvSetTest2::DoTestStepL()
sl@0
  1768
	{	
sl@0
  1769
	const TInt KNew2PixRatio    = CCamera::CCameraAdvancedSettings::EEPixelAspect40To33;
sl@0
  1770
	const TInt KNew2SuppRatios  = ( CCamera::CCameraAdvancedSettings::EEPixelAspect40To33 << 1) - 1;
sl@0
  1771
	
sl@0
  1772
	const TInt KOldPixRatio     = CCamera::CCameraAdvancedSettings::EEPixelAspect59To54;
sl@0
  1773
	const TInt KOldSuppRatios   = ( CCamera::CCameraAdvancedSettings::EEPixelAspect59To54 << 1) - 1;	
sl@0
  1774
	
sl@0
  1775
	const TInt KNew2FlashModes  = (CCamera::EFlashVideoLight << 1) - 1;
sl@0
  1776
	const TInt KNew2FlashMode   = CCamera::EFlashVideoLight;
sl@0
  1777
	
sl@0
  1778
	const TInt KOldFlashModes   = (CCamera::EFlashManual << 1) - 1;
sl@0
  1779
	const TInt KOldFlashMode    = CCamera::EFlashManual;
sl@0
  1780
	
sl@0
  1781
	const TInt KNew2OvrSuppt    = (CCamera::CCameraOverlay::EModeStillImageBurst << 1) - 1;
sl@0
  1782
	const TInt KOldOvrSuppt     = (CCamera::CCameraOverlay::EModeVideo << 1) - 1;
sl@0
  1783
		
sl@0
  1784
	CCamera* camera = NULL;
sl@0
  1785
	TInt callbackError = KErrNone;
sl@0
  1786
	TDummyObserver observer2(callbackError);
sl@0
  1787
sl@0
  1788
	TInt error = KErrNone;
sl@0
  1789
	CCamera::CCameraAdvancedSettings* settings = NULL;
sl@0
  1790
		
sl@0
  1791
	TRAP(error, camera = CCamera::New2L(observer2, 0, 100));
sl@0
  1792
	if (error!=KErrNone)
sl@0
  1793
		{
sl@0
  1794
		INFO_PRINTF2(_L("--Error creating CCamera object %d"),error);
sl@0
  1795
		User::Leave(KErrGeneral);
sl@0
  1796
		}
sl@0
  1797
	CleanupStack::PushL(camera);
sl@0
  1798
		
sl@0
  1799
    settings = static_cast<CCamera::CCameraAdvancedSettings*> 
sl@0
  1800
								(camera->CustomInterface(KECamAdvancedSettingUid));
sl@0
  1801
    if (settings == NULL)
sl@0
  1802
    	{
sl@0
  1803
    	INFO_PRINTF1(_L("--Error: Failed to get the CCameraAdvancedSettings"));
sl@0
  1804
    	User::Leave(KErrGeneral);
sl@0
  1805
    	}
sl@0
  1806
    CleanupStack::PushL(settings);
sl@0
  1807
    
sl@0
  1808
    RatioSubStepL(settings, KNew2SuppRatios, KNew2PixRatio, KNew2PixRatio);
sl@0
  1809
    FlashSubStepL(settings, KNew2FlashModes, KNew2FlashMode, KNew2FlashMode);
sl@0
  1810
    OvrSubStepL(*camera, KNew2OvrSuppt, KNew2OvrSuppt, KNew2OvrSuppt);
sl@0
  1811
        
sl@0
  1812
    CleanupStack::PopAndDestroy(2, camera);
sl@0
  1813
    
sl@0
  1814
// now try to use it as an "old" client //		
sl@0
  1815
	TRAP(error, camera = CCamera::NewL(observer2, 0, 100));
sl@0
  1816
	if (error!=KErrNone)
sl@0
  1817
		{
sl@0
  1818
		INFO_PRINTF2(_L("--Error creating CCamera object %d"),error);
sl@0
  1819
		User::Leave(KErrGeneral);
sl@0
  1820
		}
sl@0
  1821
	CleanupStack::PushL(camera);
sl@0
  1822
sl@0
  1823
    settings = static_cast<CCamera::CCameraAdvancedSettings*> 
sl@0
  1824
								(camera->CustomInterface(KECamAdvancedSettingUid));
sl@0
  1825
    if (settings == NULL)
sl@0
  1826
    	{
sl@0
  1827
    	INFO_PRINTF1(_L("--Error: Failed to get the CCameraAdvancedSettings"));
sl@0
  1828
    	User::Leave(KErrGeneral);
sl@0
  1829
    	}
sl@0
  1830
    CleanupStack::PushL(settings);
sl@0
  1831
sl@0
  1832
    RatioSubStepL(settings, KOldSuppRatios, KOldPixRatio, KOldPixRatio);
sl@0
  1833
    RatioSubStepL(settings, KOldSuppRatios, KNew2PixRatio, CCamera::CCameraAdvancedSettings::EPixelAspectUnknown);
sl@0
  1834
    
sl@0
  1835
    FlashSubStepL(settings, KOldFlashModes, KOldFlashMode, KOldFlashMode);
sl@0
  1836
    FlashSubStepL(settings, KOldFlashModes, KNew2FlashMode, CCamera::EFlashAuto);
sl@0
  1837
    
sl@0
  1838
    OvrSubStepL(*camera, KOldOvrSuppt, KOldOvrSuppt, KOldOvrSuppt);
sl@0
  1839
    OvrSubStepL(*camera, KOldOvrSuppt, CCamera::CCameraOverlay::EModeClientViewfinder, 
sl@0
  1840
                        CCamera::CCameraOverlay::EModeViewfinder);
sl@0
  1841
                        
sl@0
  1842
    OvrSubStepL(*camera, KOldOvrSuppt, CCamera::CCameraOverlay::EModeStillImageBurst, 
sl@0
  1843
                        CCamera::CCameraOverlay::EModeStillImage);
sl@0
  1844
    
sl@0
  1845
    CleanupStack::PopAndDestroy(2, camera);
sl@0
  1846
	return EPass;
sl@0
  1847
	}
sl@0
  1848
sl@0
  1849
sl@0
  1850
RECamContinuousZoomAllocTest* RECamContinuousZoomAllocTest::NewL(TBool aAllocTest)
sl@0
  1851
	{
sl@0
  1852
	RECamContinuousZoomAllocTest* self = new (ELeave) RECamContinuousZoomAllocTest(aAllocTest);
sl@0
  1853
	return self;	
sl@0
  1854
	}
sl@0
  1855
	
sl@0
  1856
RECamContinuousZoomAllocTest::RECamContinuousZoomAllocTest(TBool /*aAllocTest*/)
sl@0
  1857
	{
sl@0
  1858
	iTestStepName = _L("MM-ECM-ADV-U-058-HP");
sl@0
  1859
	}
sl@0
  1860
	
sl@0
  1861
TVerdict RECamContinuousZoomAllocTest::DoTestStepL()	
sl@0
  1862
	{
sl@0
  1863
	TVerdict verdict = EFail;
sl@0
  1864
	INFO_PRINTF1(_L("Alloc test"));
sl@0
  1865
	TInt i;
sl@0
  1866
	TInt err;
sl@0
  1867
	for (i = 1 ; ; i++)
sl@0
  1868
		{
sl@0
  1869
		__MM_HEAP_MARK;
sl@0
  1870
		
sl@0
  1871
		if (i % 5 == 0)
sl@0
  1872
			{
sl@0
  1873
			INFO_PRINTF2(_L("Fail count = %d"), i);
sl@0
  1874
			}
sl@0
  1875
sl@0
  1876
		__UHEAP_SETFAIL(RHeap::EFailNext, i);
sl@0
  1877
sl@0
  1878
		TRAP(err, verdict = DoAllocTestStepL());
sl@0
  1879
sl@0
  1880
		TAny* testAlloc = User::Alloc(1);
sl@0
  1881
		TBool heapTestingComplete = (testAlloc == NULL) && (err==KErrNone);
sl@0
  1882
		User::Free(testAlloc);
sl@0
  1883
sl@0
  1884
		__UHEAP_RESET;
sl@0
  1885
		__MM_HEAP_MARKEND;
sl@0
  1886
sl@0
  1887
		if ((err != KErrNoMemory ) || heapTestingComplete)
sl@0
  1888
			{
sl@0
  1889
			INFO_PRINTF4(_L("err = %d, verdict = %d, Fail count = %d"), err, verdict, i);
sl@0
  1890
			INFO_PRINTF1(_L("Alloc testing completed successfully"));
sl@0
  1891
			verdict = EPass;
sl@0
  1892
			break;
sl@0
  1893
			}
sl@0
  1894
		}
sl@0
  1895
	return verdict;
sl@0
  1896
	}
sl@0
  1897
	
sl@0
  1898
TVerdict RECamContinuousZoomAllocTest::DoAllocTestStepL()
sl@0
  1899
	{	
sl@0
  1900
	TVerdict result = EPass;
sl@0
  1901
	CCamera* camera = NULL;
sl@0
  1902
sl@0
  1903
	TInt error = KErrNone;
sl@0
  1904
	CCamera::CCameraAdvancedSettings* settings = NULL;
sl@0
  1905
	CCamera::CCameraContinuousZoom* zoom = NULL;
sl@0
  1906
sl@0
  1907
	// using observer 2 if exist 
sl@0
  1908
	MCameraObserver2* observer2 = NULL;
sl@0
  1909
	
sl@0
  1910
	__MM_HEAP_MARK;
sl@0
  1911
	INFO_PRINTF1(_L("Create camera using Camera::New2L() and MCameraObserver2"));
sl@0
  1912
	TRAP(error, camera = CCamera::New2L(*observer2, 0,0));
sl@0
  1913
	if (error==KErrNone)
sl@0
  1914
		{
sl@0
  1915
		CleanupStack::PushL(camera);
sl@0
  1916
		INFO_PRINTF1(_L("Create advanced settings from CCamera object"));
sl@0
  1917
		settings = 	static_cast<CCamera::CCameraAdvancedSettings*> (camera->CustomInterface(KECamAdvancedSettingUid));
sl@0
  1918
	    if (settings!= NULL)
sl@0
  1919
	    	{
sl@0
  1920
	    	CleanupStack::PushL(settings);
sl@0
  1921
	    	INFO_PRINTF1(_L("CCameraAdvancedSettings object was created"));
sl@0
  1922
	    	CCamera::CCameraAdvancedSettings::TContinuousZoomType continuousZoomType =
sl@0
  1923
	    		 		CCamera::CCameraAdvancedSettings::EContinuousZoomMixed;
sl@0
  1924
	    	
sl@0
  1925
	    	INFO_PRINTF1(_L("Create continuous zoom from advanced settings object"));
sl@0
  1926
	    	TRAP(error, settings->CreateContinuousZoomL(*this, continuousZoomType, zoom));
sl@0
  1927
	    	if (error == KErrNone)
sl@0
  1928
	    		{
sl@0
  1929
	    		CleanupStack::PushL(zoom);
sl@0
  1930
	    		}
sl@0
  1931
	    	else
sl@0
  1932
	    		{
sl@0
  1933
	    		ERR_PRINTF2(_L("Unexpected %d return from CCamera::CreateContinuousZoomL()"), error);
sl@0
  1934
	    		result = EFail;
sl@0
  1935
	    		User::Leave(KErrNoMemory);
sl@0
  1936
	    		}
sl@0
  1937
	    	}
sl@0
  1938
	    else
sl@0
  1939
    		{
sl@0
  1940
    		ERR_PRINTF1(_L("Could not create CCameraAdvancedSettings"));
sl@0
  1941
    		result = EFail;
sl@0
  1942
    		User::Leave(KErrNoMemory);
sl@0
  1943
    		}
sl@0
  1944
		}
sl@0
  1945
	else 
sl@0
  1946
		{
sl@0
  1947
		ERR_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
sl@0
  1948
		result = EFail;	
sl@0
  1949
		User::Leave(KErrNoMemory);	
sl@0
  1950
		}
sl@0
  1951
	
sl@0
  1952
	CleanupStack::PopAndDestroy(3, camera);
sl@0
  1953
	__MM_HEAP_MARKEND;
sl@0
  1954
	
sl@0
  1955
	// create a settings object using New2L
sl@0
  1956
	__MM_HEAP_MARK;
sl@0
  1957
	INFO_PRINTF1(_L("Create camera using Camera::New2L() and MCameraObserver2"));
sl@0
  1958
	
sl@0
  1959
	TRAP(error, camera = CCamera::New2L(*observer2, 0,0));
sl@0
  1960
sl@0
  1961
	if (error==KErrNone)
sl@0
  1962
		{
sl@0
  1963
		CleanupStack::PushL(camera);
sl@0
  1964
		TRAP(error, settings  = CCamera::CCameraAdvancedSettings::NewL(*camera));	
sl@0
  1965
		if (error==KErrNone)
sl@0
  1966
	    	{
sl@0
  1967
	    	CleanupStack::PushL(settings);
sl@0
  1968
	  		INFO_PRINTF1(_L("CCameraAdvancedSettings object was created using NewL")); 
sl@0
  1969
	    	CCamera::CCameraAdvancedSettings::TContinuousZoomType continuousZoomType =
sl@0
  1970
	    		 		CCamera::CCameraAdvancedSettings::EContinuousZoomMixed;
sl@0
  1971
	    	
sl@0
  1972
	    	INFO_PRINTF1(_L("Create continuous zoom from advanced settings object"));
sl@0
  1973
	    	TRAP(error, settings->CreateContinuousZoomL(*this, continuousZoomType, zoom));
sl@0
  1974
	    	if (error == KErrNone)
sl@0
  1975
	    		{
sl@0
  1976
	    		CleanupStack::PushL(zoom);
sl@0
  1977
	    		}
sl@0
  1978
	    	else
sl@0
  1979
	    		{
sl@0
  1980
	    		ERR_PRINTF2(_L("Unexpected %d return from CCamera::CreateContinuousZoomL()"), error);
sl@0
  1981
	    		result = EFail;
sl@0
  1982
	    		User::Leave(KErrNoMemory);
sl@0
  1983
	    		}
sl@0
  1984
	    	}
sl@0
  1985
	    else
sl@0
  1986
    		{
sl@0
  1987
    		ERR_PRINTF1(_L("CCameraAdvancedSettings object was not created using NewL")); 
sl@0
  1988
    		result = EFail;
sl@0
  1989
    		User::Leave(KErrNoMemory);
sl@0
  1990
    		}
sl@0
  1991
		}
sl@0
  1992
	else 
sl@0
  1993
		{
sl@0
  1994
		ERR_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
sl@0
  1995
		result = EFail;	
sl@0
  1996
		User::Leave(KErrNoMemory);	
sl@0
  1997
		}
sl@0
  1998
sl@0
  1999
	CleanupStack::PopAndDestroy(3, camera);
sl@0
  2000
	__MM_HEAP_MARKEND;
sl@0
  2001
	return result;
sl@0
  2002
	}
sl@0
  2003
sl@0
  2004
RECamContinuousZoomTest* RECamContinuousZoomTest::NewL(TBool aAllocTest)
sl@0
  2005
	{
sl@0
  2006
	RECamContinuousZoomTest* self = new (ELeave) RECamContinuousZoomTest(aAllocTest);
sl@0
  2007
	return self;	
sl@0
  2008
	}
sl@0
  2009
sl@0
  2010
RECamContinuousZoomTest::RECamContinuousZoomTest(TBool /*aAllocTest*/)
sl@0
  2011
	{
sl@0
  2012
	iTestStepName = _L("MM-ECM-ADV-U-060-HP");
sl@0
  2013
	}
sl@0
  2014
sl@0
  2015
TVerdict RECamContinuousZoomTest::DoTestStepL()
sl@0
  2016
	{
sl@0
  2017
	__MM_HEAP_MARK;
sl@0
  2018
	TVerdict result = EPass;
sl@0
  2019
	CCamera* camera = NULL;
sl@0
  2020
	TInt callbackError = KErrNone;
sl@0
  2021
	TDummyObserver observer2(callbackError);
sl@0
  2022
sl@0
  2023
	CCamera::CCameraAdvancedSettings* settings = NULL;
sl@0
  2024
		
sl@0
  2025
	camera = CCamera::New2L(observer2, 0, 0);
sl@0
  2026
	CleanupStack::PushL(camera);
sl@0
  2027
		
sl@0
  2028
    settings = static_cast<CCamera::CCameraAdvancedSettings*>(camera->CustomInterface(KECamAdvancedSettingUid));
sl@0
  2029
    if (settings == NULL)
sl@0
  2030
    	{
sl@0
  2031
    	ERR_PRINTF1(_L("--Error: Failed to get the CCameraAdvancedSettings"));
sl@0
  2032
    	User::Leave(KErrGeneral);
sl@0
  2033
    	}
sl@0
  2034
    CleanupStack::PushL(settings);
sl@0
  2035
sl@0
  2036
	TUint supportedContinuousZoomType = 100;
sl@0
  2037
	settings->GetSupportedContinuousZoomTypeL(supportedContinuousZoomType);
sl@0
  2038
	if(supportedContinuousZoomType != 0)
sl@0
  2039
		{
sl@0
  2040
		ERR_PRINTF1(_L("GetSupportedContinuousZoomTypeL supported!")); 
sl@0
  2041
		result = EFail;
sl@0
  2042
		CleanupStack::PopAndDestroy(2, camera);
sl@0
  2043
		return result;
sl@0
  2044
		}
sl@0
  2045
		
sl@0
  2046
	CCamera::CCameraAdvancedSettings::TContinuousZoomType continuousZoomType =
sl@0
  2047
		 		CCamera::CCameraAdvancedSettings::EContinuousZoomMixed;
sl@0
  2048
	
sl@0
  2049
	CCamera::CCameraContinuousZoom* continuousZoom = NULL;
sl@0
  2050
	settings->CreateContinuousZoomL(*this, continuousZoomType, continuousZoom);
sl@0
  2051
	CleanupStack::PushL(continuousZoom);
sl@0
  2052
	
sl@0
  2053
	CCamera::CCameraAdvancedSettings::TContinuousZoomSupportInfo info;
sl@0
  2054
	continuousZoom->GetContinuousZoomSupportInfoL(info);
sl@0
  2055
	
sl@0
  2056
	INFO_PRINTF1(_L("Fake supported continuous zoom settings are:"));
sl@0
  2057
	INFO_PRINTF2(_L("Max speed supported = %d"), info.iMaxSpeedSupported);
sl@0
  2058
	INFO_PRINTF2(_L("Min acceleration supported = %d"), info.iMinAccelerationSupported);
sl@0
  2059
	INFO_PRINTF2(_L("Max acceleration supported = %d"), info.iMaxAccelerationSupported);
sl@0
  2060
	INFO_PRINTF2(_L("Min continuous zoom limit = %d"), info.iContinuousZoomMinLimit);
sl@0
  2061
	INFO_PRINTF2(_L("Max continuous zoom limit = %d"), info.iContinuousZoomMaxLimit);
sl@0
  2062
	
sl@0
  2063
	CCamera::CCameraAdvancedSettings::TContinuousZoomParameters param;
sl@0
  2064
	param.iContinuousZoomType = continuousZoomType;
sl@0
  2065
	param.iContinuousZoomAcceleration = 0;
sl@0
  2066
	param.iContinuousZoomSpeed = 1;
sl@0
  2067
	param.iContinuousZoomLimit = 5;
sl@0
  2068
	param.iZoomDirection = CCamera::CCameraAdvancedSettings::EZoomDirectionWide;
sl@0
  2069
sl@0
  2070
	INFO_PRINTF1(_L("Calling StartContinuousZoomL()"));
sl@0
  2071
	continuousZoom->StartContinuousZoomL(param);
sl@0
  2072
sl@0
  2073
	INFO_PRINTF1(_L("Calling StopContinuousZoomL()"));
sl@0
  2074
	continuousZoom->StopContinuousZoom();
sl@0
  2075
	
sl@0
  2076
	INFO_PRINTF1(_L("Creating second continuous zoom object and comparing unique zoom ids"));
sl@0
  2077
	TInt id = 0;
sl@0
  2078
	TInt secondId = 0;
sl@0
  2079
	continuousZoom->GetContinuousZoomId(id);
sl@0
  2080
	
sl@0
  2081
	CCamera::CCameraContinuousZoom* secondContinuousZoom = NULL;
sl@0
  2082
	settings->CreateContinuousZoomL(*this, continuousZoomType, secondContinuousZoom);
sl@0
  2083
	secondContinuousZoom->GetContinuousZoomId(secondId);
sl@0
  2084
	
sl@0
  2085
	INFO_PRINTF2(_L("Zoom Id of first object is %d"), id);
sl@0
  2086
	INFO_PRINTF2(_L("Zoom Id of second object is %d"), secondId);
sl@0
  2087
	if(id == secondId)
sl@0
  2088
		{
sl@0
  2089
		ERR_PRINTF1(_L("Zoom ids of both continuous zoom objects are the same"));
sl@0
  2090
		result = EFail;
sl@0
  2091
		delete secondContinuousZoom;
sl@0
  2092
		CleanupStack::PopAndDestroy(3, camera);
sl@0
  2093
		return result;
sl@0
  2094
		}
sl@0
  2095
	delete secondContinuousZoom;
sl@0
  2096
	
sl@0
  2097
	INFO_PRINTF1(_L("Attempting to start continuous zoom with 'unsupported' values"));
sl@0
  2098
	param.iContinuousZoomSpeed = 100;
sl@0
  2099
	param.iContinuousZoomAcceleration = -10;
sl@0
  2100
	param.iContinuousZoomLimit = 20;
sl@0
  2101
	TRAPD(err, continuousZoom->StartContinuousZoomL(param));
sl@0
  2102
	if(err == KErrArgument)
sl@0
  2103
		{
sl@0
  2104
		INFO_PRINTF2(_L("StartContinuousZoom() correctly failed with %d"), err);
sl@0
  2105
		}
sl@0
  2106
	else if(err == KErrNone)
sl@0
  2107
		{
sl@0
  2108
		ERR_PRINTF1(_L("StartContinuousZoom() succeeded with unsupported values"));
sl@0
  2109
		result = EFail;
sl@0
  2110
		}
sl@0
  2111
	else
sl@0
  2112
		{
sl@0
  2113
		ERR_PRINTF2(_L("StartContinuousZoom() failed with unexpected error %d"), err);
sl@0
  2114
		result = EFail;
sl@0
  2115
		}
sl@0
  2116
	
sl@0
  2117
	CleanupStack::PopAndDestroy(3, camera);
sl@0
  2118
	__MM_HEAP_MARKEND;
sl@0
  2119
	return result;
sl@0
  2120
	}
sl@0
  2121
sl@0
  2122
sl@0
  2123
RECamDependantSupportedDriveModesTest* RECamDependantSupportedDriveModesTest::NewL(TBool aAllocTest)
sl@0
  2124
	{
sl@0
  2125
	RECamDependantSupportedDriveModesTest* self = new (ELeave) RECamDependantSupportedDriveModesTest(aAllocTest);
sl@0
  2126
	return self;	
sl@0
  2127
	}
sl@0
  2128
sl@0
  2129
RECamDependantSupportedDriveModesTest::RECamDependantSupportedDriveModesTest(TBool /*aAllocTest*/)
sl@0
  2130
	{
sl@0
  2131
	iTestStepName = _L("MM-ECM-ADV-U-061-HP");
sl@0
  2132
	}
sl@0
  2133
sl@0
  2134
TVerdict RECamDependantSupportedDriveModesTest::DoTestStepL()
sl@0
  2135
	{
sl@0
  2136
	__MM_HEAP_MARK;
sl@0
  2137
	TVerdict result = EPass;
sl@0
  2138
	CCamera* camera = NULL;
sl@0
  2139
	MCameraObserver* observer = NULL;
sl@0
  2140
	MCameraObserver2* observer2 = NULL;
sl@0
  2141
	CCamera::CCameraAdvancedSettings* settings = NULL;
sl@0
  2142
sl@0
  2143
	INFO_PRINTF1(_L("Testing drive modes returned for legacy CCamera::NewL()"));
sl@0
  2144
	camera = CCamera::NewL(*observer, 0);
sl@0
  2145
	CleanupStack::PushL(camera);
sl@0
  2146
		
sl@0
  2147
    settings = static_cast<CCamera::CCameraAdvancedSettings*>(camera->CustomInterface(KECamAdvancedSettingUid));
sl@0
  2148
    if (settings == NULL)
sl@0
  2149
    	{
sl@0
  2150
    	ERR_PRINTF1(_L("--Error: Failed to get the CCameraAdvancedSettings"));
sl@0
  2151
    	User::Leave(KErrGeneral);
sl@0
  2152
    	}
sl@0
  2153
    CleanupStack::PushL(settings);
sl@0
  2154
sl@0
  2155
    CCamera::CCameraAdvancedSettings::TDriveMode driveMode = settings->DriveMode();
sl@0
  2156
    if(driveMode != CCamera::CCameraAdvancedSettings::EDriveModeAuto)
sl@0
  2157
    	{
sl@0
  2158
    	ERR_PRINTF1(_L("Drive mode returned for CCamera::NewL() not CCameraAdvancedSettings::EDriveModeAuto as expected"));
sl@0
  2159
    	result = EFail;
sl@0
  2160
    	return result;
sl@0
  2161
    	}
sl@0
  2162
sl@0
  2163
    TInt supportedDriveModes = settings->SupportedDriveModes();
sl@0
  2164
    if(supportedDriveModes & CCamera::CCameraAdvancedSettings::EDriveModeTimeNudgeCapture)
sl@0
  2165
    	{
sl@0
  2166
    	ERR_PRINTF1(_L("Unexpected error - EDriveModeTimeNudgeCapture supported for CCamera::NewL()"));
sl@0
  2167
    	result = EFail;
sl@0
  2168
    	return result;
sl@0
  2169
    	}
sl@0
  2170
sl@0
  2171
    settings->SetDriveMode(CCamera::CCameraAdvancedSettings::EDriveModeTimeNudgeCapture);
sl@0
  2172
    driveMode = settings->DriveMode();
sl@0
  2173
    if(driveMode == CCamera::CCameraAdvancedSettings::EDriveModeTimeNudgeCapture)
sl@0
  2174
    	{
sl@0
  2175
    	ERR_PRINTF1(_L("Unexpected error - drive mode is EDriveModeTimeNudgeCapture for CCamera::NewL()"));
sl@0
  2176
    	result = EFail;
sl@0
  2177
    	return result;
sl@0
  2178
    	}
sl@0
  2179
    else
sl@0
  2180
    	{
sl@0
  2181
    	INFO_PRINTF1(_L("Supported drive modes do not include new EDriveTimeNudgeCapture - expected for CCamera::NewL()"));
sl@0
  2182
    	}
sl@0
  2183
    CleanupStack::PopAndDestroy(2, camera);
sl@0
  2184
sl@0
  2185
sl@0
  2186
sl@0
  2187
    INFO_PRINTF1(_L("Now testing drive modes returned for CCamera::New2L()"));
sl@0
  2188
	camera = CCamera::New2L(*observer2, 0, 0);
sl@0
  2189
	CleanupStack::PushL(camera);
sl@0
  2190
		
sl@0
  2191
    settings = static_cast<CCamera::CCameraAdvancedSettings*>(camera->CustomInterface(KECamAdvancedSettingUid));
sl@0
  2192
    if (settings == NULL)
sl@0
  2193
    	{
sl@0
  2194
    	ERR_PRINTF1(_L("--Error: Failed to get the CCameraAdvancedSettings"));
sl@0
  2195
    	User::Leave(KErrGeneral);
sl@0
  2196
    	}
sl@0
  2197
    CleanupStack::PushL(settings);
sl@0
  2198
sl@0
  2199
    supportedDriveModes = settings->SupportedDriveModes();
sl@0
  2200
    settings->SetDriveMode(CCamera::CCameraAdvancedSettings::EDriveModeTimeNudgeCapture);
sl@0
  2201
    driveMode = settings->DriveMode();
sl@0
  2202
    CleanupStack::PopAndDestroy(2, camera);
sl@0
  2203
sl@0
  2204
    if(!(supportedDriveModes & CCamera::CCameraAdvancedSettings::EDriveModeTimeNudgeCapture))
sl@0
  2205
    	{
sl@0
  2206
    	ERR_PRINTF1(_L("Unexpected error - EDriveModeTimeNudgeCapture not supported for CCamera::New2L()"));
sl@0
  2207
    	result = EFail;
sl@0
  2208
    	return result;
sl@0
  2209
    	}
sl@0
  2210
    else if(driveMode != CCamera::CCameraAdvancedSettings::EDriveModeTimeNudgeCapture)
sl@0
  2211
    	{
sl@0
  2212
    	ERR_PRINTF1(_L("Unexpected error - drive mode is not EDriveModeTimeNudgeCapture for CCamera::New2L()"));
sl@0
  2213
    	result = EFail;
sl@0
  2214
    	return result;
sl@0
  2215
    	}
sl@0
  2216
    else
sl@0
  2217
    	{
sl@0
  2218
    	INFO_PRINTF1(_L("Supported drive modes include new EDriveTimeNudgeCapture - expected for CCamera::New2L()"));
sl@0
  2219
    	}
sl@0
  2220
sl@0
  2221
	__MM_HEAP_MARKEND;
sl@0
  2222
	return result;
sl@0
  2223
	}