os/mm/imagingandcamerafws/cameraunittest/src/TSU_ECM_ADV/ECamPresetsTest.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/imagingandcamerafws/cameraunittest/src/TSU_ECM_ADV/ECamPresetsTest.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,570 @@
     1.4 +
     1.5 +// ECamPresetsTest.cpp
     1.6 +
     1.7 +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.8 +// All rights reserved.
     1.9 +// This component and the accompanying materials are made available
    1.10 +// under the terms of "Eclipse Public License v1.0"
    1.11 +// which accompanies this distribution, and is available
    1.12 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.13 +//
    1.14 +// Initial Contributors:
    1.15 +// Nokia Corporation - initial contribution.
    1.16 +//
    1.17 +// Contributors:
    1.18 +//
    1.19 +// Description:
    1.20 +//
    1.21 +
    1.22 +#include <ecamuids.hrh>
    1.23 +#include <ecom/ecomresolverparams.h>
    1.24 +#include "ECamPresetsTest.h"
    1.25 +#include "ECamUnitTestPluginUids.hrh"
    1.26 +#include "ECamUnitTestPlugin.h"
    1.27 +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
    1.28 +#include <ecamadvsettingsuidsconst.hrh>
    1.29 +#include <ecamadvsettingsconst.h>
    1.30 +#include <ecamimageprocessingconst.h>
    1.31 +#endif
    1.32 +//
    1.33 +// RECamPresetsTest
    1.34 +//
    1.35 +RECamPresetsTest* RECamPresetsTest::NewL(TBool aAllocTest)
    1.36 +	{
    1.37 +	RECamPresetsTest* self = new (ELeave) RECamPresetsTest(aAllocTest);
    1.38 +	return self;	
    1.39 +	}
    1.40 +	
    1.41 +RECamPresetsTest::RECamPresetsTest(TBool /*aAllocTest*/)
    1.42 +	{
    1.43 +	iTestStepName = _L("MM-ECM-ADV-U-006-HP");
    1.44 +	}
    1.45 +	
    1.46 +TVerdict RECamPresetsTest::DoTestStepL()
    1.47 +	{
    1.48 +	TVerdict verdict = EFail;
    1.49 +	INFO_PRINTF1(_L("Alloc test"));
    1.50 +	TInt i;
    1.51 +	TInt err;
    1.52 +	for (i = 1 ; ; i++)
    1.53 +		{
    1.54 +		__MM_HEAP_MARK;
    1.55 +		
    1.56 +		if (i % 5 == 0)
    1.57 +			{
    1.58 +			INFO_PRINTF2(_L("Fail count = %d"), i);
    1.59 +			}
    1.60 +
    1.61 +		__UHEAP_SETFAIL(RHeap::EFailNext, i);
    1.62 +
    1.63 +		TRAP(err, verdict = DoPresetsTestStepL());
    1.64 +
    1.65 +		TAny* testAlloc = User::Alloc(1);
    1.66 +		TBool heapTestingComplete = (testAlloc == NULL) && (err==KErrNone);
    1.67 +		User::Free(testAlloc);
    1.68 +
    1.69 +		__UHEAP_RESET;
    1.70 +		__MM_HEAP_MARKEND;
    1.71 +
    1.72 +		if ((err != KErrNoMemory ) || heapTestingComplete)
    1.73 +			{
    1.74 +			INFO_PRINTF4(_L("err = %d, verdict = %d, Fail count = %d"), err, verdict, i);
    1.75 +			INFO_PRINTF1(_L("Alloc testing completed successfully"));
    1.76 +			verdict = EPass;
    1.77 +			break;
    1.78 +			}
    1.79 +		}
    1.80 +	return verdict;
    1.81 +	}
    1.82 +	
    1.83 +TVerdict RECamPresetsTest::DoPresetsTestStepL()
    1.84 +	{	
    1.85 +	TVerdict result = EPass;
    1.86 +	CCamera* camera = NULL;
    1.87 +	
    1.88 +	TInt error = KErrNone;
    1.89 +	CCamera::CCameraPresets* presets = NULL;
    1.90 +		
    1.91 +	// using observer 2 
    1.92 +	MCameraObserver2* observer2 = NULL; 
    1.93 +	
    1.94 +	__MM_HEAP_MARK;
    1.95 +	INFO_PRINTF1(_L("Create camera using Camera::New2L() and MCameraObserver2"));
    1.96 +	
    1.97 +	TRAP(error, camera = CCamera::New2L(*observer2, 0,0));
    1.98 +
    1.99 +	if (error==KErrNone)
   1.100 +		{
   1.101 +		CleanupStack::PushL(camera);
   1.102 +		INFO_PRINTF1(_L("KErrNone return from CCamera::New2L()"));
   1.103 +		presets = 	static_cast<CCamera::CCameraPresets*> (camera->CustomInterface(KECamPresetsUid));
   1.104 +	    if (presets!= NULL)
   1.105 +	    	{
   1.106 +	    	CleanupStack::PushL(presets);
   1.107 +	  		INFO_PRINTF1(_L("CCameraPresets object was created")); 
   1.108 +	    	CleanupStack::PopAndDestroy(presets);
   1.109 +	    	}
   1.110 +	    else
   1.111 +    		{
   1.112 +    		result = EFail;
   1.113 +    		User::Leave(KErrNoMemory);
   1.114 +    		}	
   1.115 +		CleanupStack::PopAndDestroy(camera);
   1.116 +		}
   1.117 +	else 
   1.118 +		{
   1.119 +		INFO_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
   1.120 +		result = EFail;	
   1.121 +		User::Leave(KErrNoMemory);	
   1.122 +		}
   1.123 +	__MM_HEAP_MARKEND;
   1.124 +	
   1.125 +	// create a presets object using NewL
   1.126 +	__MM_HEAP_MARK;
   1.127 +	INFO_PRINTF1(_L("Create camera using Camera::NewL() and MCameraObserver2"));
   1.128 +	
   1.129 +	TRAP(error, camera = CCamera::New2L(*observer2, 0,0));
   1.130 +
   1.131 +	if (error==KErrNone)
   1.132 +		{
   1.133 +		CleanupStack::PushL(camera);
   1.134 +		INFO_PRINTF1(_L("KErrNone return from CCamera::New2L()"));
   1.135 +		TRAP(error, presets  = CCamera::CCameraPresets::NewL(*camera));	
   1.136 +		
   1.137 +		if (error==KErrNone)
   1.138 +	    	{
   1.139 +	    	CleanupStack::PushL(presets);
   1.140 +	  		INFO_PRINTF1(_L("CCameraPresets object was created using NewL")); 
   1.141 +	    	CleanupStack::PopAndDestroy(presets);
   1.142 +	    	}
   1.143 +	    else
   1.144 +    		{
   1.145 +    		INFO_PRINTF1(_L("CCameraPresets object was not created using NewL")); 
   1.146 +    		result = EFail;
   1.147 +    		User::Leave(KErrNoMemory);
   1.148 +    		}	
   1.149 +		CleanupStack::PopAndDestroy(camera);
   1.150 +		}
   1.151 +	else 
   1.152 +		{
   1.153 +		INFO_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
   1.154 +		result = EFail;
   1.155 +		User::Leave(KErrNoMemory);		
   1.156 +		}
   1.157 +	__MM_HEAP_MARKEND;
   1.158 +   
   1.159 +	return result;
   1.160 +	}
   1.161 +	
   1.162 +//
   1.163 +// RECamPresetsNotificationTest
   1.164 +//
   1.165 +RECamPresetsNotificationTest* RECamPresetsNotificationTest::NewL(TBool aAllocTest)
   1.166 +	{
   1.167 +	RECamPresetsNotificationTest* self = new (ELeave) RECamPresetsNotificationTest(aAllocTest);
   1.168 +	CleanupStack::PushL(self);
   1.169 +	self->ConstructL();
   1.170 +	CleanupStack::Pop(self);
   1.171 +	return self;	
   1.172 +	}
   1.173 +	
   1.174 +void RECamPresetsNotificationTest::ConstructL()
   1.175 +	{
   1.176 +	iOriginalSet.Reset();
   1.177 +	iResultSet.Reset();
   1.178 +
   1.179 +	}
   1.180 +RECamPresetsNotificationTest::RECamPresetsNotificationTest(TBool /*aAllocTest*/)
   1.181 +	{
   1.182 +	iTestStepName = _L("MM-ECM-ADV-U-008-HP");
   1.183 +	}
   1.184 +	
   1.185 +TVerdict RECamPresetsNotificationTest::DoTestStepL()
   1.186 +	{	
   1.187 +	TVerdict result = EPass;
   1.188 +	CCamera* camera = NULL;
   1.189 +	
   1.190 +	TInt error = KErrNone;
   1.191 +	CCamera::CCameraPresets* presets = NULL;
   1.192 +		
   1.193 +	__MM_HEAP_MARK;
   1.194 +	INFO_PRINTF1(_L("Create camera using Camera::New2L() and MCameraObserver2"));
   1.195 +	
   1.196 +	TRAP(error, camera = CCamera::New2L(*this,0,0));
   1.197 +
   1.198 +	if (error==KErrNone)
   1.199 +		{
   1.200 +		CleanupStack::PushL(camera);
   1.201 +		//	CCamUnitTestPlugin* camera1 = static_cast<CCamUnitTestPlugin*>(camera);
   1.202 +		//  rely on public member, done for simplfication of an external 
   1.203 +		//  initialization as it is the simplest way
   1.204 +		//	camera1->iPresets = iOriginalSet;
   1.205 +		INFO_PRINTF1(_L("KErrNone return from CCamera::New2L()"));
   1.206 +		presets = static_cast<CCamera::CCameraPresets*> (camera->CustomInterface(KECamPresetsUid));
   1.207 +	    if (presets!= NULL)
   1.208 +	    	{
   1.209 +	    	CleanupStack::PushL(presets);
   1.210 +	    	
   1.211 +	    	// get the supported set of values  
   1.212 +	    	presets->GetSupportedPresetsL(iResultSet);
   1.213 +
   1.214 +	    	//verify that the input and output are the same
   1.215 +	    	INFO_PRINTF2(_L("camera supports %d presets"),  iResultSet.Count());
   1.216 +	       
   1.217 +	    	// the array should not be empty 
   1.218 +	        if (iResultSet.Count()==0)
   1.219 +	        	{
   1.220 +	        	result = EFail;
   1.221 +	        	}
   1.222 +        	else
   1.223 +        		{
   1.224 +        		iResultSet.Reset();
   1.225 +        		}
   1.226 +        		
   1.227 +        	INFO_PRINTF1(_L("Current preset shall be  KUidECamPresetNone"));	
   1.228 +	    	TUid currentPreset = presets->Preset();	    	
   1.229 +	    
   1.230 +	    	// Current Preset shall be KUidECamPresetNone.
   1.231 +	    	if(currentPreset.iUid != KUidECamPresetNoneUidValue)
   1.232 +	    		{
   1.233 +	    		INFO_PRINTF1(_L("Current preset wrongly set"));
   1.234 +	    		result = EFail;
   1.235 +	    		}
   1.236 +	    	
   1.237 +	    	// set new value
   1.238 +	    	iInputEventUid = KUidECamPresetBeach;
   1.239 +	        INFO_PRINTF2(_L("Select a new preset %d"), iInputEventUid.iUid); 
   1.240 +	        presets->SetPreset(iInputEventUid);
   1.241 +	        
   1.242 +	        CheckNotification(iInputEventUid, result);
   1.243 +    			
   1.244 +    		presets->GetAffectedSettingsL(iResultSet);
   1.245 +    		INFO_PRINTF2(_L("This preset affected %d settings"),  iResultSet.Count());
   1.246 +    		
   1.247 +    		// get the alternative function
   1.248 +    		RArray<TUid> associatedSettings;
   1.249 +    		CleanupClosePushL(associatedSettings);
   1.250 +    		associatedSettings.Reset();
   1.251 +    		INFO_PRINTF1(_L("Get associated settings for the selected preset"));
   1.252 +    		TRAP(error,presets->GetAssociatedSettingsL(iInputEventUid, associatedSettings));
   1.253 +			if(error != KErrNone)
   1.254 +				{
   1.255 +				CleanupStack::PopAndDestroy(&associatedSettings);
   1.256 +				}
   1.257 +				
   1.258 +			if (iResultSet.Count()!=associatedSettings.Count())
   1.259 +	        	{
   1.260 +	        	result = EFail;
   1.261 +	        	}
   1.262 +        	else
   1.263 +        		{
   1.264 +        		iResultSet.Reset();
   1.265 +        		}	
   1.266 +        	CleanupStack::PopAndDestroy(&associatedSettings);
   1.267 +    		
   1.268 +    		// set KUidECamPresetOutdoor to get range restricted settings.
   1.269 +	    	iInputEventUid = KUidECamPresetOutdoor;
   1.270 +	        INFO_PRINTF2(_L("Select the Outdoor preset %d"), iInputEventUid.iUid); 
   1.271 +	        presets->SetPreset(iInputEventUid);
   1.272 +	        
   1.273 +	        INFO_PRINTF1(_L("Check the RangeRestricted notification"));
   1.274 +    		CheckNotification(KUidECamEventRangeRestricted, result);
   1.275 +	        
   1.276 +	        if(result != EFail)
   1.277 +	        	{
   1.278 +	        	INFO_PRINTF1(_L("Retrieve the RangeRestricted settings"));
   1.279 +	        	// get the range restricted settings
   1.280 +	    		RArray<TUid> rangeRestrictedSettings;	
   1.281 +	    		presets->GetRangeRestrictedSettingsL(rangeRestrictedSettings);
   1.282 +	    		if (rangeRestrictedSettings.Count() == 0)
   1.283 +		        	{
   1.284 +		        	INFO_PRINTF1(_L("RangeRestricted settings are Zero"));
   1.285 +		        	result = EFail;
   1.286 +		        	}
   1.287 +	        	rangeRestrictedSettings.Close();
   1.288 +	        	}
   1.289 +	        
   1.290 +	        INFO_PRINTF1(_L("Check the FeatureRestricted settings"));
   1.291 +	        // get the feature restricted settings
   1.292 +	    	RArray<TUid> featureRestrictedSettings;
   1.293 +    		presets->GetFeatureRestrictedSettingsL(featureRestrictedSettings);
   1.294 +    		if (featureRestrictedSettings.Count() != 0)
   1.295 +	        	{
   1.296 +	        	INFO_PRINTF1(_L("FeatureRestricted settings are not Zero"));
   1.297 +	        	result = EFail;
   1.298 +	        	}
   1.299 +	        featureRestrictedSettings.Close();
   1.300 +	        
   1.301 +	        TBool unlockSupported = EFalse;
   1.302 +	       	presets->IsPresetUnlockSupportedL(unlockSupported);
   1.303 +	       	if(!unlockSupported)
   1.304 +	       		{
   1.305 +	       		INFO_PRINTF1(_L("Preset Unlock not supported"));
   1.306 +	       		result = EFail;
   1.307 +	       		}
   1.308 +	       	
   1.309 +	       	INFO_PRINTF1(_L("Unlock Preset"));	
   1.310 +	       	presets->UnlockPresetL();
   1.311 +	       	CheckNotification(KUidECamEventPresetUnlocked, result);
   1.312 +	       	
   1.313 +	       	INFO_PRINTF1(_L("Lock Preset"));	
   1.314 +	       	presets->LockPresetL();
   1.315 +	       	CheckNotification(KUidECamEventPresetLocked, result);
   1.316 +	       	
   1.317 +    		CleanupStack::PopAndDestroy(presets);
   1.318 +	    	}
   1.319 +	    else
   1.320 +    		{
   1.321 +    		result = EFail;
   1.322 +    		User::Leave(KErrNoMemory);
   1.323 +    		}
   1.324 +    	
   1.325 +    	CleanupStack::PopAndDestroy(camera);
   1.326 +		}
   1.327 +	else 
   1.328 +		{
   1.329 +		INFO_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
   1.330 +		result = EFail;	
   1.331 +		User::Leave(KErrNoMemory);
   1.332 +		}
   1.333 +	
   1.334 +	__MM_HEAP_MARKEND;
   1.335 +
   1.336 +	return result;
   1.337 +	}
   1.338 +
   1.339 +//
   1.340 +// RECamPresetsNegTest //
   1.341 +//
   1.342 +RECamPresetsNegTest* RECamPresetsNegTest::NewL(TBool aAllocTest)
   1.343 +	{
   1.344 +	RECamPresetsNegTest* self = new (ELeave) RECamPresetsNegTest(aAllocTest);
   1.345 +	return self;	
   1.346 +	}
   1.347 +	
   1.348 +RECamPresetsNegTest::RECamPresetsNegTest(TBool /*aAllocTest*/)
   1.349 +	{
   1.350 +	iTestStepName = _L("MM-ECM-ADV-U-0101-HP");
   1.351 +	}
   1.352 +	
   1.353 +TVerdict RECamPresetsNegTest::DoTestStepL()
   1.354 +	{	
   1.355 +	TVerdict result = EPass;
   1.356 +	CCamera* camera = NULL;
   1.357 +	
   1.358 +	TInt error = KErrNone;
   1.359 +	CCamera::CCameraPresets* presets = NULL;		
   1.360 +	
   1.361 +	__MM_HEAP_MARK;
   1.362 +	
   1.363 +	INFO_PRINTF1(_L("Create camera using Camera::New2L() and MCameraObserver2"));
   1.364 +	
   1.365 +	TRAP(error, camera = CCamera::New2L(*this,0,0));
   1.366 +
   1.367 +	if (error==KErrNone)
   1.368 +		{
   1.369 +		CleanupStack::PushL(camera);
   1.370 +		INFO_PRINTF1(_L("KErrNone return from CCamera::New2L()"));
   1.371 +		presets = static_cast<CCamera::CCameraPresets*> (camera->CustomInterface(KECamPresetsUid));
   1.372 +	    if (presets!= NULL)
   1.373 +	    	{
   1.374 +	    	CleanupStack::PushL(presets);	   
   1.375 +	    	 	
   1.376 +			TUid aCurrentPreset = presets->Preset();
   1.377 +	    	// get the current value
   1.378 +	    	INFO_PRINTF2(_L("Current preset %x"), aCurrentPreset.iUid);
   1.379 +	    	
   1.380 +	    	// get the supported set of values      	
   1.381 +			RArray<TUid> aResultSet;
   1.382 +			CleanupClosePushL(aResultSet);
   1.383 +			aResultSet.Reset();
   1.384 +	    	presets->GetSupportedPresetsL(aResultSet);
   1.385 +
   1.386 +	        // Setting a non supported preset should be rejected       
   1.387 +	        // In the test plugin only KUidECamPresetOutdoor, KUidECamPresetNightPartyIndoor & KUidECamPresetBeach are supported
   1.388 +	 	    iInputEventUid = KUidECamPresetIndoorSport;	    	
   1.389 +	    	presets->SetPreset(iInputEventUid);	    
   1.390 +   		    	
   1.391 +	        CheckNotificationNeg(iInputEventUid, result); 
   1.392 +	        
   1.393 +	        // Setting a non supported preset should be rejected       
   1.394 +	        // In the test plugin only KUidECamPresetOutdoor, KUidECamPresetNightPartyIndoor & KUidECamPresetBeach are supported
   1.395 +	 	    iInputEventUid = KUidECamPresetVideoTelephony;	    	
   1.396 +	    	presets->SetPreset(iInputEventUid);	    
   1.397 +   		    	
   1.398 +	        CheckNotificationNeg(iInputEventUid, result);
   1.399 +	           				    		
   1.400 +	    	TUid aGetPreset = presets->Preset();
   1.401 +	    	
   1.402 +	      	if ((aCurrentPreset == aGetPreset) && (aGetPreset == KUidECamPresetNone))
   1.403 +	        	{
   1.404 +	    		INFO_PRINTF2(_L("Current preset has not changed %x"), aGetPreset.iUid);	        	
   1.405 +	        	}
   1.406 +	        else
   1.407 +	        	{
   1.408 +				INFO_PRINTF1(_L("Expected no affected settings"));
   1.409 +				result = EFail;
   1.410 +	        	}	    	 	
   1.411 +
   1.412 +	    	// get the affected settings	        	
   1.413 +			RArray<TUid> aAffectedSet;
   1.414 +			CleanupClosePushL(aAffectedSet);
   1.415 +			presets->GetAffectedSettingsL(aAffectedSet);	    	    		     
   1.416 +	        // the list of affected settings should be empty 
   1.417 +	        if (aAffectedSet.Count()!=0)
   1.418 +	        	{
   1.419 +				INFO_PRINTF1(_L("Expected no affected settings"));
   1.420 +				result = EFail;
   1.421 +	        	}
   1.422 +	        else
   1.423 +	        	{
   1.424 +				INFO_PRINTF1(_L("No affected settings"));	        		
   1.425 +	        	}
   1.426 +	        	
   1.427 +			CleanupStack::PopAndDestroy(2, &aResultSet); //aAffectedSet
   1.428 +	    	
   1.429 +	    	CleanupStack::PopAndDestroy(presets);
   1.430 +	    	}
   1.431 +	    else // preset is NULL
   1.432 +    		{
   1.433 +    		result = EFail;
   1.434 +    		}	
   1.435 +		CleanupStack::PopAndDestroy(camera);
   1.436 +		}
   1.437 +	else // error != KErrNone
   1.438 +		{
   1.439 +		INFO_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
   1.440 +		result = EFail;		
   1.441 +		}
   1.442 +	__MM_HEAP_MARKEND;
   1.443 +
   1.444 +	return result;
   1.445 +	}
   1.446 +	
   1.447 +//
   1.448 +// RECamPresetsBaselineTest
   1.449 +//
   1.450 +RECamPresetsBaselineTest* RECamPresetsBaselineTest::NewL(TBool aAllocTest)
   1.451 +	{
   1.452 +	RECamPresetsBaselineTest* self = new (ELeave) RECamPresetsBaselineTest(aAllocTest);
   1.453 +	CleanupStack::PushL(self);
   1.454 +	self->ConstructL();
   1.455 +	CleanupStack::Pop(self);
   1.456 +	return self;	
   1.457 +	}
   1.458 +	
   1.459 +void RECamPresetsBaselineTest::ConstructL()
   1.460 +	{
   1.461 +	iOriginalSet.Reset();
   1.462 +	iResultSet.Reset();
   1.463 +
   1.464 +	}
   1.465 +RECamPresetsBaselineTest::RECamPresetsBaselineTest(TBool /*aAllocTest*/)
   1.466 +	{
   1.467 +	iTestStepName = _L("MM-ECM-ADV-U-046-HP");
   1.468 +	}
   1.469 +
   1.470 +TVerdict RECamPresetsBaselineTest::DoTestStepL()
   1.471 +	{	
   1.472 +	TVerdict result = EPass;
   1.473 +	CCamera* camera = NULL;
   1.474 +	
   1.475 +	TInt error = KErrNone;
   1.476 +	CCamera::CCameraPresets* presets = NULL;
   1.477 +		
   1.478 +	__MM_HEAP_MARK;
   1.479 +	INFO_PRINTF1(_L("Create camera using Camera::NewL() and MCameraObserver2"));
   1.480 +	
   1.481 +	TRAP(error, camera = CCamera::NewL(*this,0,0));
   1.482 +
   1.483 +	if (error==KErrNone)
   1.484 +		{
   1.485 +		CleanupStack::PushL(camera);
   1.486 +		//	CCamUnitTestPlugin* camera1 = static_cast<CCamUnitTestPlugin*>(camera);
   1.487 +		//  rely on public member, done for simplfication of an external 
   1.488 +		//  initialization as it is the simplest way
   1.489 +		//	camera1->iPresets = iOriginalSet;
   1.490 +		INFO_PRINTF1(_L("KErrNone return from CCamera::NewL()"));
   1.491 +		presets = static_cast<CCamera::CCameraPresets*> (camera->CustomInterface(KECamPresetsUid));
   1.492 +	    if (presets!= NULL)
   1.493 +	    	{
   1.494 +	    	CleanupStack::PushL(presets);
   1.495 +	    	
   1.496 +	    	// get the supported set of values  
   1.497 +	    	presets->GetSupportedPresetsL(iResultSet);
   1.498 +
   1.499 +	    	//verify that the input and output are the same
   1.500 +	    	INFO_PRINTF2(_L("camera supports %d presets"),  iResultSet.Count());
   1.501 +	       
   1.502 +	    	// the array should not contain any unfamiliar uid for preset(after baseline) 
   1.503 +	        for(TInt index =0; index < iResultSet.Count(); index++)
   1.504 +				{
   1.505 +				/** KUidECamPresetFactoryDefaultUidValue is the baseline. Any preset with greater uid value means that it has 
   1.506 +				been added in later versions */
   1.507 +				if(iResultSet[index].iUid > KUidECamPresetFactoryDefaultUidValue)
   1.508 +					{
   1.509 +					result = EFail;
   1.510 +					}
   1.511 +				}
   1.512 +	        	        
   1.513 +	        iResultSet.Reset();
   1.514 +        	
   1.515 +	    	presets->Preset();	    	
   1.516 +	    	// set new unfamiliar value
   1.517 +	    	iInputEventUid = KUidECamPresetNightPartyIndoor; 
   1.518 +	        INFO_PRINTF2(_L("Select a new preset %d"), iInputEventUid.iUid); 
   1.519 +	        presets->SetPreset(iInputEventUid);
   1.520 +	        
   1.521 +	        CheckNotification(iInputEventUid, result);
   1.522 +	        
   1.523 +	        if(presets->Preset().iUid != KUidECamPresetFactoryDefaultUidValue)
   1.524 +	        	{
   1.525 +	        	result = EFail;
   1.526 +	        	}
   1.527 +    			
   1.528 +    		presets->GetAffectedSettingsL(iResultSet);
   1.529 +    		INFO_PRINTF2(_L("This preset affected %d settings"),  iResultSet.Count());
   1.530 +    		
   1.531 +    		// the array should not contain any unfamiliar uid for settings(after baseline) 
   1.532 +	        for(TInt index =0; index < iResultSet.Count(); index++)
   1.533 +				{
   1.534 +				/** KUidECamEventCameraSettingAutoFocusType2UidValue is the baseline. Any settings with greater uid value means that it has 
   1.535 +				been added in later versions */
   1.536 +				if(iResultSet[index].iUid > KUidECamEventCameraSettingAutoFocusType2UidValue)
   1.537 +					{
   1.538 +					result = EFail;
   1.539 +					}
   1.540 +				}
   1.541 +    		
   1.542 +    		// get the alternative function
   1.543 +    		RArray<TUid> associatedSettings;
   1.544 +    		
   1.545 +    		presets->GetAssociatedSettingsL(iInputEventUid, associatedSettings);
   1.546 +
   1.547 +			if (iResultSet.Count()!=associatedSettings.Count())
   1.548 +	        	{
   1.549 +	        	result = EFail;
   1.550 +	        	}
   1.551 +        	else
   1.552 +        		{
   1.553 +        		iResultSet.Reset();
   1.554 +        		}	
   1.555 +    		associatedSettings.Close();
   1.556 +	    	CleanupStack::PopAndDestroy(presets);
   1.557 +	    	}
   1.558 +	    else
   1.559 +    		{
   1.560 +    		result = EFail;
   1.561 +    		}
   1.562 +		CleanupStack::PopAndDestroy(camera);
   1.563 +		}
   1.564 +	else 
   1.565 +		{
   1.566 +		INFO_PRINTF2(_L("Unexpected %d return from CCamera::NewL(): observer 2"), error);
   1.567 +		result = EFail;		
   1.568 +		}
   1.569 +	
   1.570 +	__MM_HEAP_MARKEND;
   1.571 +
   1.572 +	return result;
   1.573 +	}