1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/imagingandcamerafws/cameraunittest/src/TSU_ECM_ADV/ECamAdvSetTest.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,2223 @@
1.4 +
1.5 +// ECamAdvSetTest.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 <fbs.h>
1.23 +
1.24 +#include <ecamuids.hrh>
1.25 +#include "ECamUnitTestPluginUids.hrh"
1.26 +#include "ECamAdvSetTest.h"
1.27 +#include <ecam/ecamplugin.h>
1.28 +
1.29 +#include <ecom/ecomresolverparams.h>
1.30 +#include "ECamUnitTestPlugin.h"
1.31 +#include "AdvancedSettings.h"
1.32 +#include <ecam/cameraoverlay.h>
1.33 +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
1.34 +#include <ecamconst.h>
1.35 +#include <ecamadvsettingsconst.h>
1.36 +#endif
1.37 +
1.38 +const TInt KShutterSpeed = 20;
1.39 +const TInt KIsoRate01 = 320;
1.40 +const TInt KIsoRate0 = 150;
1.41 +const TInt KValue = 100;
1.42 +const TInt KContinuousAutoFocusTimeoutValue1 = 10000;
1.43 +//const TRgb KRgbConst = TRgb(100,124,130);
1.44 +const TInt KWBColorTemperature1 = 4300;
1.45 +const TInt KDefaultIsoRating = 200;
1.46 +const TInt KDefaultAperture = 280;
1.47 +const TInt KAllPreCaptureWarnings = 0x3FFF;
1.48 +const TInt KBaselinedFocusRanges = 0x1F;
1.49 +const TInt KBaselinedWhiteBalanceModes = 0x01FF;
1.50 +const TInt KFlashCompensationStep = 2;
1.51 +const TInt KFlashCompensationInSteps = 1;
1.52 +const TInt KExposureCompensationStep = 3;
1.53 +const TInt KExposureCompensationInSteps = 2;
1.54 +const TInt KAutoISOTypes =0x1E;
1.55 +/*
1.56 +const TInt KDefaultValue = 0;
1.57 +const TInt KContinuousAutoFocusTimeoutValue = 20000;
1.58 +const TInt KBrightnessAdjMinValue = -50;
1.59 +const TInt KBrightnessAdjMaxValue = 50;
1.60 +
1.61 +const TInt KMaxIsoRate = 200;
1.62 +const TInt KMinIsoRate = 0;
1.63 +const TInt KDefaultShutterSpeed = 0;
1.64 +const TInt KDefaultFocusDistance = 0;
1.65 +
1.66 +const TInt KBracketStartIndex = 0;
1.67 +const TInt KBracketFrames = 2;
1.68 +const TBool KDefaultRedEyeReduce = EFalse;
1.69 +
1.70 +const TBool KExternalFlashPresentState = EFalse;
1.71 +const TInt KManualFlashPowerLevel = 0;
1.72 +const TBool KApertureExposureLockOn = EFalse;
1.73 +const TBool KShootClickOn = EFalse;
1.74 +const TInt KTimerInterval = 0;
1.75 +const TInt KBurstImages = 0;
1.76 +const TBool KExposureLockOn = EFalse;
1.77 +const TBool KAutoFocusLockOn = EFalse;
1.78 +const TBool KAutomaticSizeSelectionChangeOn = EFalse;
1.79 +const TInt KWBColorTemperature = 6000;
1.80 +*/
1.81 +//
1.82 +// RECamAdvSetTest
1.83 +//
1.84 +RECamAdvSetTest* RECamAdvSetTest::NewL(TBool aAllocTest)
1.85 + {
1.86 + RECamAdvSetTest* self = new (ELeave) RECamAdvSetTest(aAllocTest);
1.87 + return self;
1.88 + }
1.89 +
1.90 +RECamAdvSetTest::RECamAdvSetTest(TBool /*aAllocTest*/)
1.91 + {
1.92 + iTestStepName = _L("MM-ECM-ADV-U-005-HP");
1.93 + }
1.94 +
1.95 +TVerdict RECamAdvSetTest::DoTestStepL()
1.96 + {
1.97 + TVerdict verdict = EFail;
1.98 + INFO_PRINTF1(_L("Alloc test"));
1.99 + TInt i;
1.100 + TInt err;
1.101 + for (i = 1 ; ; i++)
1.102 + {
1.103 + __MM_HEAP_MARK;
1.104 +
1.105 + if (i % 5 == 0)
1.106 + {
1.107 + INFO_PRINTF2(_L("Fail count = %d"), i);
1.108 + }
1.109 +
1.110 + __UHEAP_SETFAIL(RHeap::EFailNext, i);
1.111 +
1.112 + TRAP(err, verdict = DoAdvTestStepL());
1.113 +
1.114 + TAny* testAlloc = User::Alloc(1);
1.115 + TBool heapTestingComplete = (testAlloc == NULL) && (err==KErrNone);
1.116 + User::Free(testAlloc);
1.117 +
1.118 + __UHEAP_RESET;
1.119 + __MM_HEAP_MARKEND;
1.120 +
1.121 + if ((err != KErrNoMemory ) || heapTestingComplete)
1.122 + {
1.123 + INFO_PRINTF4(_L("err = %d, verdict = %d, Fail count = %d"), err, verdict, i);
1.124 + INFO_PRINTF1(_L("Alloc testing completed successfully"));
1.125 + verdict = EPass;
1.126 + break;
1.127 + }
1.128 + }
1.129 + return verdict;
1.130 + }
1.131 +
1.132 +TVerdict RECamAdvSetTest::DoAdvTestStepL()
1.133 + {
1.134 + TVerdict result = EPass;
1.135 + CCamera* camera = NULL;
1.136 +
1.137 + TInt error = KErrNone;
1.138 + CCamera::CCameraAdvancedSettings* settings = NULL;
1.139 +
1.140 + // using observer 2 if exist
1.141 + MCameraObserver2* observer2 = NULL;
1.142 +
1.143 + __MM_HEAP_MARK;
1.144 + INFO_PRINTF1(_L("Create camera using Camera::New2L() and MCameraObserver2"));
1.145 + TRAP(error, camera = CCamera::New2L(*observer2, 0,0));
1.146 + if (error==KErrNone)
1.147 + {
1.148 + CleanupStack::PushL(camera);
1.149 + INFO_PRINTF1(_L("Create advanced settings from CCamera object"));
1.150 + settings = static_cast<CCamera::CCameraAdvancedSettings*> (camera->CustomInterface(KECamAdvancedSettingUid));
1.151 + if (settings!= NULL)
1.152 + {
1.153 + CleanupStack::PushL(settings);
1.154 + INFO_PRINTF1(_L("CCameraAdvancedSettings object was created"));
1.155 + CleanupStack::PopAndDestroy(settings);
1.156 + }
1.157 + else
1.158 + {
1.159 + result = EFail;
1.160 + User::Leave(KErrNoMemory);
1.161 + }
1.162 + CleanupStack::PopAndDestroy(camera);
1.163 + }
1.164 + else
1.165 + {
1.166 + INFO_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
1.167 + result = EFail;
1.168 + User::Leave(KErrNoMemory);
1.169 + }
1.170 + __MM_HEAP_MARKEND;
1.171 +
1.172 + // create a settings object using New2L
1.173 + __MM_HEAP_MARK;
1.174 + INFO_PRINTF1(_L("Create camera using Camera::New2L() and MCameraObserver2"));
1.175 +
1.176 + TRAP(error, camera = CCamera::New2L(*observer2, 0,0));
1.177 +
1.178 + if (error==KErrNone)
1.179 + {
1.180 + CleanupStack::PushL(camera);
1.181 + INFO_PRINTF1(_L("KErrNone return from CCamera::New2L()"));
1.182 + TRAP(error, settings = CCamera::CCameraAdvancedSettings::NewL(*camera));
1.183 + if (error==KErrNone)
1.184 + {
1.185 + CleanupStack::PushL(settings);
1.186 + INFO_PRINTF1(_L("CCameraAdvancedSettings object was created using NewL"));
1.187 + CleanupStack::PopAndDestroy(settings);
1.188 + }
1.189 + else
1.190 + {
1.191 + INFO_PRINTF1(_L("CCameraAdvancedSettings object was not created using NewL"));
1.192 + result = EFail;
1.193 + User::Leave(KErrNoMemory);
1.194 + }
1.195 + CleanupStack::PopAndDestroy(camera);
1.196 + }
1.197 + else
1.198 + {
1.199 + INFO_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
1.200 + result = EFail;
1.201 + User::Leave(KErrNoMemory);
1.202 + }
1.203 + __MM_HEAP_MARKEND;
1.204 + return result;
1.205 + }
1.206 +
1.207 +RECamAdvSetNotificationTest* RECamAdvSetNotificationTest::NewL(TBool aAllocTest)
1.208 + {
1.209 + RECamAdvSetNotificationTest* self = new (ELeave) RECamAdvSetNotificationTest(aAllocTest);
1.210 + CleanupStack::PushL(self);
1.211 + self->ConstructL();
1.212 + CleanupStack::Pop(self);
1.213 + return self;
1.214 + }
1.215 +
1.216 +void RECamAdvSetNotificationTest::ConstructL()
1.217 + {
1.218 + iError = KErrNone;
1.219 + }
1.220 +
1.221 +RECamAdvSetNotificationTest::RECamAdvSetNotificationTest(TBool /*aAllocTest*/)
1.222 + {
1.223 + iTestStepName = _L("MM-ECM-ADV-U-009-HP");
1.224 + }
1.225 +
1.226 +TVerdict RECamAdvSetNotificationTest::DoTestStepL()
1.227 + {
1.228 + TVerdict result = EPass;
1.229 + CCamera* camera = NULL;
1.230 +
1.231 + TInt error = KErrNone;
1.232 + TInt cameraIndex = 1;
1.233 + TBool cameraPresent = EFalse;
1.234 +
1.235 + __MM_HEAP_MARK;
1.236 + TInt cameras = CCamera::CamerasAvailable();
1.237 + INFO_PRINTF2(_L("Available %d cameras"), cameras);
1.238 + INFO_PRINTF1(_L("Create camera using Camera::New2L() and MCameraObserver2"));
1.239 + TRAP(error, camera = CCamera::New2L(*this, 0,0));
1.240 + if (error==KErrNone)
1.241 + {
1.242 + CleanupStack::PushL(camera);
1.243 + MCamManagement* extFunct = NULL;
1.244 +
1.245 + // get the MCamera management inteface implementation
1.246 + // remember it is for the purpose of this test written to
1.247 + // notify this camera clients... it should be a static(singlenton)
1.248 + // to cater for the general case, but this is just a test, not impl example.
1.249 + extFunct = static_cast<CCamManagement*>
1.250 + (camera->CustomInterface(KUidCameraManagementUid));
1.251 +
1.252 + if (extFunct != NULL)
1.253 + {
1.254 + CleanupStack::PushL(extFunct);
1.255 +
1.256 + CCamera::CCameraAdvancedSettings* settings = static_cast<CCamera::CCameraAdvancedSettings*> (camera->CustomInterface(KECamAdvancedSettingUid));
1.257 + CleanupStack::PushL(settings);
1.258 +
1.259 + // enumerate camera types
1.260 + for (TInt index = 0; index < cameras; index++)
1.261 + {
1.262 + CCamera::CCameraAdvancedSettings::TCameraType type = settings->CameraType(index);
1.263 + INFO_PRINTF3(_L("camera with index %d type %d"), index, type);
1.264 + if (type == CCamera::CCameraAdvancedSettings::ECameraUnknown)
1.265 + {
1.266 + result = EFail;
1.267 + }
1.268 + }
1.269 +
1.270 + // check that indexed and non indexed versions work produce the same result
1.271 + INFO_PRINTF1(_L("Check that indexed and non indexed versions work in the same way"));
1.272 + TInt thisCameraIndex = settings->CameraIndex();
1.273 + // camera type
1.274 + if (settings->CameraType() != settings->CameraType(thisCameraIndex))
1.275 + {
1.276 + INFO_PRINTF2(_L("CameraType() and CameraType(%d) produce different results"),thisCameraIndex);
1.277 + result = EFail;
1.278 + }
1.279 + // for this camera
1.280 + settings->IsCameraPresent();
1.281 + if (settings->IsCameraPresent() != settings->IsCameraPresent(thisCameraIndex))
1.282 + {
1.283 + INFO_PRINTF2(_L("IsCameraPresent() and IsCameraPresent(%d) produce different results"),thisCameraIndex);
1.284 + result = EFail;
1.285 + }
1.286 +
1.287 + // verify that the required camera is not present - different index
1.288 + cameraPresent = settings->IsCameraPresent(cameraIndex);
1.289 + INFO_PRINTF3(_L("camera with index %d %d"), cameraIndex, cameraPresent);
1.290 + if (cameraPresent)
1.291 + {
1.292 + result = EFail;
1.293 + }
1.294 +
1.295 + INFO_PRINTF2(_L("Plug in camera with index %d"), cameraIndex);
1.296 + extFunct->PlugCameraIn(cameraIndex);
1.297 + CheckNotification(KUidECamEventGlobalCamera01PluggedIn, result);
1.298 +
1.299 + cameraPresent = settings->IsCameraPresent(cameraIndex);
1.300 + INFO_PRINTF3(_L("camera with index %d %d"), cameraIndex, cameraPresent);
1.301 + if (!cameraPresent)
1.302 + {
1.303 + result = EFail;
1.304 + }
1.305 +
1.306 + INFO_PRINTF2(_L("Plug out camera with index %d"), cameraIndex);
1.307 + extFunct->PlugCameraOut(cameraIndex);
1.308 + CheckNotification(KUidECamEventGlobalCamera01PluggedOut, result);
1.309 +
1.310 + cameraPresent = settings->IsCameraPresent(cameraIndex);
1.311 + INFO_PRINTF3(_L("camera with index %d %d"), cameraIndex, cameraPresent);
1.312 + if (cameraPresent)
1.313 + {
1.314 + result = EFail;
1.315 + }
1.316 +
1.317 + CleanupStack::PopAndDestroy(settings);
1.318 +
1.319 + CleanupStack::Pop(extFunct);
1.320 + extFunct->Release();
1.321 + }
1.322 + else
1.323 + {
1.324 + INFO_PRINTF1(_L("Could not obtain camera management interface?"));
1.325 + result = EFail;
1.326 + }
1.327 + CleanupStack::PopAndDestroy(camera);
1.328 + }
1.329 +
1.330 + else
1.331 + {
1.332 + INFO_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
1.333 + result = EFail;
1.334 + }
1.335 + __MM_HEAP_MARKEND;
1.336 + return result;
1.337 + }
1.338 +
1.339 +
1.340 +//
1.341 +// RECamAdvSetDefaultsTest //
1.342 +//
1.343 +RECamAdvSetDefaultsTest* RECamAdvSetDefaultsTest::NewL(TBool aAllocTest)
1.344 + {
1.345 + RECamAdvSetDefaultsTest* self = new (ELeave) RECamAdvSetDefaultsTest(aAllocTest);
1.346 + return self;
1.347 + }
1.348 +
1.349 +RECamAdvSetDefaultsTest::RECamAdvSetDefaultsTest(TBool)
1.350 + {
1.351 + iTestStepName = _L("MM-ECM-ADV-U-010-HP");
1.352 + }
1.353 +
1.354 +TVerdict RECamAdvSetDefaultsTest::DoTestStepL()
1.355 + {
1.356 + TVerdict result = EPass;
1.357 + CCamera* camera = NULL;
1.358 +
1.359 + TInt error = KErrNone;
1.360 + CCamera::CCameraAdvancedSettings* settings = NULL;
1.361 +
1.362 + __MM_HEAP_MARK;
1.363 + INFO_PRINTF1(_L("Create camera using Camera::New2L() and MCameraObserver2"));
1.364 + TRAP(error, camera = CCamera::New2L(*this, 0,0));
1.365 + if (error==KErrNone)
1.366 + {
1.367 + CleanupStack::PushL(camera);
1.368 + INFO_PRINTF1(_L("Create advanced settings from CCamera object"));
1.369 + settings = static_cast<CCamera::CCameraAdvancedSettings*> (camera->CustomInterface(KECamAdvancedSettingUid));
1.370 + if (settings!= NULL)
1.371 + {
1.372 + CleanupStack::PushL(settings);
1.373 +
1.374 + // Supported Focus Modes. Set default Focus Mode. Get Focus Mode.
1.375 + iInputEventUid = KUidECamEventCameraSettingFocusMode;
1.376 + TInt suppFocusModes = settings->SupportedFocusModes();
1.377 + INFO_PRINTF2(_L("CCameraAdvancedSettings supported Focus Modes 0x%x"), suppFocusModes);
1.378 + CCamera::CCameraAdvancedSettings::TFocusMode defaultFocusMode = CCamera::CCameraAdvancedSettings::EFocusModeAuto;
1.379 + settings->SetFocusMode(defaultFocusMode);
1.380 +
1.381 + CheckNotification(iInputEventUid, result);
1.382 +
1.383 + CCamera::CCameraAdvancedSettings::TFocusMode retrievedFocusMode = settings->FocusMode();
1.384 + if (defaultFocusMode != retrievedFocusMode)
1.385 + {
1.386 + INFO_PRINTF3(_L("CCameraAdvancedSettings retrieved Focus Mode 0x%x is not the default 0x%x "),
1.387 + retrievedFocusMode, defaultFocusMode);
1.388 + result = EFail;
1.389 + }
1.390 +
1.391 + // Supported Focus Range. Set default Focus Range. Get Focus Range.
1.392 + iInputEventUid = KUidECamEventCameraSettingFocusRange;
1.393 + TInt suppFocusRanges = settings->SupportedFocusRanges();
1.394 + INFO_PRINTF2(_L("CCameraAdvancedSettings supported Focus Ranges 0x%x"), suppFocusRanges);
1.395 + CCamera::CCameraAdvancedSettings::TFocusRange defaultFocusRange = CCamera::CCameraAdvancedSettings::EFocusRangeAuto;
1.396 + settings->SetFocusRange(defaultFocusRange);
1.397 +
1.398 + // Check for KUidECamEventCameraSettingFocusRange.
1.399 + CheckNotification(iInputEventUid, result);
1.400 +
1.401 + CCamera::CCameraAdvancedSettings::TFocusRange retrievedFocusRange = settings->FocusRange();
1.402 + if (defaultFocusRange != retrievedFocusRange)
1.403 + {
1.404 + INFO_PRINTF3(_L("CCameraAdvancedSettings retrieved Focus Range 0x%x is not the default 0x%x"),
1.405 + retrievedFocusRange, defaultFocusRange);
1.406 + result = EFail;
1.407 + }
1.408 +
1.409 + // Check for KUidECamEventCameraSettingFocusRangeTwo.
1.410 + iInputEventUid = KUidECamEventCameraSettingFocusRange2;
1.411 + CheckNotificationTwo(iInputEventUid, result);
1.412 +
1.413 + // Supported Auto Focus Type. Set default Auto Focus Type. Get Auto Focus Type.
1.414 + iInputEventUid = KUidECamEventCameraSettingAutoFocusType;
1.415 + TInt suppAutoFocusTypes = settings->SupportedAutoFocusTypes();
1.416 + INFO_PRINTF2(_L("CCameraAdvancedSettings supported Focus Types 0x%x"), suppAutoFocusTypes);
1.417 + CCamera::CCameraAdvancedSettings::TAutoFocusType defaultAutoFocusType = CCamera::CCameraAdvancedSettings::EAutoFocusTypeOff;
1.418 + settings->SetAutoFocusType(defaultAutoFocusType);
1.419 +
1.420 + // Check for KUidECamEventCameraSettingAutoFocusType.
1.421 + CheckNotification (iInputEventUid, result);
1.422 +
1.423 + CCamera::CCameraAdvancedSettings::TAutoFocusType retrievedAutoFocusType = settings->AutoFocusType() ;
1.424 + if (defaultAutoFocusType!=retrievedAutoFocusType)
1.425 + {
1.426 + INFO_PRINTF3(_L("CCameraAdvancedSettings retrieved Auto Focus Type 0x%x is not the default 0x%x"),
1.427 + retrievedAutoFocusType, defaultAutoFocusType);
1.428 + result = EFail;
1.429 + }
1.430 +
1.431 + // Check for KUidECamEventCameraSettingAutoFocusTypeTwo
1.432 + iInputEventUid = KUidECamEventCameraSettingAutoFocusType2;
1.433 + CheckNotificationTwo(iInputEventUid, result);
1.434 +
1.435 + // Supported Auto Focus Area. Set default Auto Focus Area. Get Auto Focus Area.
1.436 + iInputEventUid = KUidECamEventCameraSettingAutoFocusArea;
1.437 + TInt suppAutoFocusArea = settings->SupportedAutoFocusAreas();
1.438 + INFO_PRINTF2(_L("CCameraAdvancedSettings supported Focus Areas 0x%x"), suppAutoFocusArea);
1.439 + CCamera::CCameraAdvancedSettings::TAutoFocusArea defaultAutoFocusArea = CCamera::CCameraAdvancedSettings::EAutoFocusTypeAuto;
1.440 + settings->SetAutoFocusArea(defaultAutoFocusArea);
1.441 +
1.442 + CheckNotification(iInputEventUid, result);
1.443 +
1.444 + CCamera::CCameraAdvancedSettings::TAutoFocusArea retrievedAutoFocusArea = settings->AutoFocusArea() ;
1.445 + if (defaultAutoFocusArea!=retrievedAutoFocusArea)
1.446 + {
1.447 + INFO_PRINTF3(_L("CCameraAdvancedSettings retrieved Auto Focus Area 0x%x is not the default 0x%x"),
1.448 + retrievedAutoFocusArea, defaultAutoFocusArea);
1.449 + result = EFail;
1.450 + }
1.451 +
1.452 + // Focus distance
1.453 + iInputEventUid = KUidECamEventCameraSettingFocusDistance;
1.454 + TInt dummyFocusDistance = 3;
1.455 + settings->SetFocusDistance(dummyFocusDistance);
1.456 +
1.457 + CheckNotification(iInputEventUid, result);
1.458 +
1.459 + TInt retrievedFocusDist = settings->FocusDistance();
1.460 + if (dummyFocusDistance!=retrievedFocusDist)
1.461 + {
1.462 + INFO_PRINTF3(_L("CCameraAdvancedSettings Focus distance 0x%x is not as expected 0x%x"),
1.463 + dummyFocusDistance, retrievedFocusDist);
1.464 + result = EFail;
1.465 + }
1.466 +
1.467 + // Min Focal Length
1.468 + TInt minFocalLength = settings->GetMinFocalLength();
1.469 + if (KErrNotSupported!=minFocalLength)
1.470 + {
1.471 + INFO_PRINTF1(_L("Supported min Focal Length"));
1.472 + result = EFail;
1.473 + }
1.474 +
1.475 + // Supported Iso Rates. Set default Iso Rate. Get Iso Rate. OLD API
1.476 + iInputEventUid = KUidECamEventCameraSettingIsoRate;
1.477 + RArray<TInt> isoRates;
1.478 + TInt suppIsoRates = 0;
1.479 + settings->GetSupportedIsoRatesL(isoRates);
1.480 + suppIsoRates = isoRates[0];
1.481 + isoRates.Close();
1.482 + INFO_PRINTF2(_L("CCameraAdvancedSettings supported Iso Rates 0x%x"), suppIsoRates);
1.483 + TInt defaultIsoRate = KDefaultIsoRating;
1.484 + settings->SetIsoRate(defaultIsoRate);
1.485 +
1.486 + CheckNotification(iInputEventUid, result);
1.487 +
1.488 + TInt retrievedIsoRate = settings->IsoRate();
1.489 + if (defaultIsoRate!=retrievedIsoRate)
1.490 + {
1.491 + INFO_PRINTF3(_L("CCameraAdvancedSettings Iso Rate %d is not as expected %d"),
1.492 + defaultIsoRate, retrievedIsoRate);
1.493 + result = EFail;
1.494 + }
1.495 +
1.496 + CCamera::CCameraAdvancedSettings::TISORateType isoRateType;
1.497 + TInt param =0;
1.498 + TInt isoRate =0;
1.499 + settings->GetISORateL(isoRateType, param, isoRate);
1.500 +
1.501 + if (isoRateType != CCamera::CCameraAdvancedSettings::EISOManual)
1.502 + {
1.503 + INFO_PRINTF3(_L("CCameraAdvancedSettings New and Old API for Iso Rate Type not consistent 0x%x is not as expected 0x%x"),
1.504 + isoRateType, CCamera::CCameraAdvancedSettings::EISOManual);
1.505 + result = EFail;
1.506 + }
1.507 +
1.508 + if (defaultIsoRate != isoRate)
1.509 + {
1.510 + INFO_PRINTF3(_L("CCameraAdvancedSettings New and Old API for Iso Rate not consistent %d is not as expected %d"),
1.511 + isoRate, defaultIsoRate);
1.512 + result = EFail;
1.513 + }
1.514 +
1.515 + // Supported Iso Types. Set default Iso Type. Set Default ISO Rate. Get Iso Type and Rate. New API
1.516 + iInputEventUid = KUidECamEventCameraSettingIsoRateType;
1.517 +
1.518 + TInt supportedISORateTypes = 0;
1.519 + settings->GetSupportedISORateTypeL(supportedISORateTypes);
1.520 +
1.521 + INFO_PRINTF2(_L("CCameraAdvancedSettings supported Iso Rate Types 0x%x"), supportedISORateTypes);
1.522 + defaultIsoRate = KDefaultIsoRating;
1.523 + CCamera::CCameraAdvancedSettings::TISORateType defaultIsoRateType = CCamera::CCameraAdvancedSettings::EISOManual;
1.524 + if(defaultIsoRateType & supportedISORateTypes)
1.525 + {
1.526 + settings->SetISORateL(defaultIsoRateType, defaultIsoRate);
1.527 +
1.528 + CheckNotification(iInputEventUid, result);
1.529 +
1.530 + param =0;
1.531 + isoRate =0;
1.532 +
1.533 + settings->GetISORateL(isoRateType, param, isoRate);
1.534 +
1.535 + if(isoRateType != defaultIsoRateType)
1.536 + {
1.537 + INFO_PRINTF3(_L("CCameraAdvancedSettings Iso Rate Type 0x%x is not as expected 0x%x"),
1.538 + isoRateType, defaultIsoRateType);
1.539 + result = EFail;
1.540 + }
1.541 +
1.542 + if(isoRate != defaultIsoRate)
1.543 + {
1.544 + INFO_PRINTF3(_L("CCameraAdvancedSettings Iso Rate %d is not as expected %d"),
1.545 + isoRate, defaultIsoRate);
1.546 + result = EFail;
1.547 + }
1.548 + }
1.549 +
1.550 + // Supported apertures. Set and Get aperture.
1.551 + iInputEventUid = KUidECamEventCameraSettingAperture;
1.552 + RArray<TInt> suppApertures;
1.553 + TValueInfo valueInfo = ENotActive;
1.554 + settings->GetAperturesL(suppApertures, valueInfo);
1.555 + // should not have entries
1.556 + if (suppApertures.Count() != 0)
1.557 + {
1.558 + result = EFail;
1.559 + }
1.560 +
1.561 + TInt dummyAperture = KDefaultAperture;
1.562 + settings->SetAperture(dummyAperture);
1.563 +
1.564 + CheckNotification(iInputEventUid, result);
1.565 +
1.566 + TInt aperture = settings->Aperture() ;
1.567 + if (dummyAperture != aperture)
1.568 + {
1.569 + INFO_PRINTF3(_L("CCameraAdvancedSettings Aperture 0x%x is not as expected 0x%x"),
1.570 + dummyAperture, aperture);
1.571 +
1.572 + result = EFail;
1.573 + }
1.574 +
1.575 + // Supported shutter speed. Set and Get shutter speed
1.576 + iInputEventUid = KUidECamEventCameraSettingShutterSpeed;
1.577 + RArray<TInt> suppShutterSpeed;
1.578 + TValueInfo shutterSpeedValueInfo = ENotActive;
1.579 + settings->GetShutterSpeedsL(suppShutterSpeed, shutterSpeedValueInfo );
1.580 + // should not have entries
1.581 + if (suppShutterSpeed.Count() != 0)
1.582 + {
1.583 + result = EFail;
1.584 + }
1.585 +
1.586 + TInt dummyShutterSpeed = KShutterSpeed;
1.587 + settings->SetShutterSpeed(dummyShutterSpeed);
1.588 +
1.589 + CheckNotification(iInputEventUid, result);
1.590 +
1.591 + TInt shutterSpeed = settings->ShutterSpeed() ;
1.592 + if (dummyShutterSpeed != shutterSpeed)
1.593 + {
1.594 + INFO_PRINTF3(_L("CCameraAdvancedSettings Shutter Speed 0x%x is not as expected 0x%x"),
1.595 + dummyShutterSpeed, shutterSpeed);
1.596 +
1.597 + result = EFail;
1.598 + }
1.599 +
1.600 + // Supported Metering Modes
1.601 + iInputEventUid = KUidECamEventCameraSettingMeteringMode;
1.602 + TInt suppMeteringModes = settings->SupportedMeteringModes();
1.603 + INFO_PRINTF2(_L("CCameraAdvancedSettings supported Metering Modes 0x%x"), suppMeteringModes);
1.604 + CCamera::CCameraAdvancedSettings::TMeteringMode defaultMeteringMode = CCamera::CCameraAdvancedSettings::EMeteringModeAuto;
1.605 + settings->SetMeteringMode(defaultMeteringMode);
1.606 +
1.607 + CheckNotification (iInputEventUid, result);
1.608 +
1.609 + CCamera::CCameraAdvancedSettings::TMeteringMode retrievedMeteringMode = settings->MeteringMode() ;
1.610 + if (defaultMeteringMode != retrievedMeteringMode)
1.611 + {
1.612 + INFO_PRINTF3(_L("CCameraAdvancedSettings Metering Mode 0x%x is not as expected 0x%x"),
1.613 + defaultMeteringMode, retrievedMeteringMode);
1.614 + result = EFail;
1.615 + }
1.616 +
1.617 +
1.618 + // Supported Bracket Modes
1.619 + iInputEventUid = KUidECamEventCameraSettingBracketMode;
1.620 + TInt suppBracketModes = settings->SupportedBracketModes();
1.621 + INFO_PRINTF2(_L("CCameraAdvancedSettings supported Bracket Modes 0x%x"), suppBracketModes);
1.622 + CCamera::CCameraAdvancedSettings::TBracketMode defaultBracketMode = CCamera::CCameraAdvancedSettings::EBracketModeOff;
1.623 + settings->SetBracketMode(defaultBracketMode);
1.624 +
1.625 + CheckNotification(iInputEventUid, result);
1.626 +
1.627 + CCamera::CCameraAdvancedSettings::TBracketMode retrievedBracketMode = settings->BracketMode() ;
1.628 + if (defaultBracketMode != retrievedBracketMode)
1.629 + {
1.630 + INFO_PRINTF3(_L("CCameraAdvancedSettings Drive Mode 0x%x is not as expected 0x%x"),
1.631 + defaultBracketMode, retrievedBracketMode);
1.632 + result = EFail;
1.633 + }
1.634 +
1.635 +
1.636 + // Supported AF assistant light. Set and Get AF assistant light.
1.637 + iInputEventUid = KUidECamEventCameraSettingAFAssistantLight;
1.638 + TInt suppAFAssistantLights =0;
1.639 +
1.640 + settings->GetSupportedAFAssistantLightL(suppAFAssistantLights);
1.641 +
1.642 + INFO_PRINTF2(_L("CCameraAdvancedSettings supported AF Assistant Lights 0x%x"), suppAFAssistantLights);
1.643 + CCamera::CCameraAdvancedSettings::TAFAssistantLight defaultAFAssistantLight = CCamera::CCameraAdvancedSettings::EAFAssistantLightOff;
1.644 + settings->SetAFAssistantLightL(defaultAFAssistantLight);
1.645 +
1.646 + CheckNotification(iInputEventUid, result);
1.647 +
1.648 + CCamera::CCameraAdvancedSettings::TAFAssistantLight retrievedAFAssistantLight;
1.649 + settings->GetAFAssistantLightL(retrievedAFAssistantLight);
1.650 +
1.651 + if (defaultAFAssistantLight != retrievedAFAssistantLight)
1.652 + {
1.653 + INFO_PRINTF3(_L("CCameraAdvancedSettings AF Assistant Light 0x%x is not as expected 0x%x"),
1.654 + retrievedAFAssistantLight, defaultAFAssistantLight);
1.655 + result = EFail;
1.656 + }
1.657 +
1.658 + TInt preCaptureWarningSupported = KAllPreCaptureWarnings; // ( = 0x3FFF)
1.659 + settings->GetPreCaptureWarningSupportedL(CCamera::CCameraAdvancedSettings::EModeIdle, preCaptureWarningSupported);
1.660 +
1.661 + // subscribe for pre capture warnings. Poll for it. Unsubscribe for Pre capture warning.
1.662 + settings->SubscribeToPreCaptureWarningL(preCaptureWarningSupported);
1.663 +
1.664 + //Poll to know the status of every possible warning ...
1.665 + TInt warningStatus =0;
1.666 + settings->GetPreCaptureWarningL(warningStatus);
1.667 +
1.668 + settings->UnSubscribePreCaptureWarningL();
1.669 +
1.670 + //set reference screen
1.671 + iInputEventUid = KUidECamEventCameraSettingReferenceScreen;
1.672 +
1.673 + CWsScreenDevice* screenDevice = NULL;
1.674 + // prepare the screen targetted.
1.675 +
1.676 + settings->SetReferenceScreenL(*screenDevice);
1.677 +
1.678 + CheckNotification(iInputEventUid, result);
1.679 +
1.680 +
1.681 + INFO_PRINTF1(_L("API exercise"));
1.682 + // API exercise
1.683 + TBool lock = ETrue;
1.684 + TInt value = KValue;
1.685 + settings->SetApertureExposureLockOn(lock);
1.686 + settings->ApertureExposureLockOn();
1.687 +
1.688 + // Automatic selection
1.689 + settings->SetAutomaticSizeSelectionChangeOn(EFalse);
1.690 + settings->AutomaticSizeSelectionChangeOn();
1.691 +
1.692 + // stabilization mode
1.693 + // settings
1.694 + settings->SupportedStabilizationModes();
1.695 + settings->StabilizationMode();
1.696 + settings->SetStabilizationMode(CCamera::CCameraAdvancedSettings::EStabilizationModeVertical);
1.697 +
1.698 + settings->SupportedBracketParameters();
1.699 + settings->BracketParameter();
1.700 + settings->SetBracketParameter(CCamera::CCameraAdvancedSettings::BracketParameterAutoFocus);
1.701 + settings->SupportedBracketSteps();
1.702 + settings->BracketStep();
1.703 + settings->SetBracketStep(CCamera::CCameraAdvancedSettings::EBracketStepMedium);
1.704 +
1.705 + TInt startIndex;
1.706 + TInt frames;
1.707 +
1.708 + settings->GetBracketMerge(startIndex, frames);
1.709 + settings->SetBracketMerge(startIndex, frames);
1.710 +
1.711 + settings->SupportedFlashModes();
1.712 + settings->FlashMode();
1.713 + settings->SetFlashMode(CCamera::EFlashSlowRearSync);
1.714 + settings->RedEyeReduceOn();
1.715 + settings->SetRedEyeReduceOn(EFalse);
1.716 +
1.717 + RArray<TInt> steps;
1.718 + TValueInfo info;
1.719 +
1.720 + settings->GetFlashCompensationStepsL(steps, info);
1.721 + TInt flashCompensationStep1 = settings->FlashCompensationStep();
1.722 + if(flashCompensationStep1 != KFlashCompensationStep)
1.723 + {
1.724 + INFO_PRINTF2(_L("old method for FlashCompensationStep retrieving wrong value %d"),flashCompensationStep1);
1.725 + result = EFail;
1.726 + }
1.727 +
1.728 + TInt flashCompensationStep2 = 0;
1.729 + TInt err = settings->GetFlashCompensationStep(flashCompensationStep2);
1.730 + if(flashCompensationStep1 != flashCompensationStep2)
1.731 + {
1.732 + INFO_PRINTF1(_L("old and new method for FlashCompensationStep retrieving wrong/dissimilar values"));
1.733 + result = EFail;
1.734 + }
1.735 + if(err)
1.736 + {
1.737 + INFO_PRINTF2(_L("new method for FlashCompensationStep had error %d"),err);
1.738 + result = EFail;
1.739 + }
1.740 +
1.741 + settings->SetFlashCompensationStep(value);
1.742 + TRAP(error, settings->GetCurrentFocusModeStepsL(steps, info));
1.743 +
1.744 + TInt negValue;
1.745 + TInt posValue;
1.746 + TBool ready = ETrue;
1.747 +
1.748 + settings->GetFlashCompensationRangeInSteps(negValue, posValue);
1.749 + TInt flashCompensation1 = settings->FlashCompensation();
1.750 + if(flashCompensation1 != KFlashCompensationInSteps)
1.751 + {
1.752 + INFO_PRINTF2(_L("old method for FlashCompensation retrieving wrong value %d"),flashCompensation1);
1.753 + result = EFail;
1.754 + }
1.755 + TInt flashCompensation2 = 0;
1.756 + err = settings->GetFlashCompensation(flashCompensation2);
1.757 +
1.758 + if(flashCompensation1 != flashCompensation2)
1.759 + {
1.760 + INFO_PRINTF1(_L("old and new method for FlashCompensation retrieving wrong/dissimilar values"));
1.761 + result = EFail;
1.762 + }
1.763 + if(err)
1.764 + {
1.765 + INFO_PRINTF2(_L("new method for FlashCompensation had error %d"),err);
1.766 + result = EFail;
1.767 + }
1.768 +
1.769 + settings->SetFlashCompensation(value);
1.770 +
1.771 + settings->IsFlashReady(ready);
1.772 + if(ready != EFalse) // The value the pugin has been set to return
1.773 + {
1.774 + result = EFail;
1.775 + }
1.776 + settings->IsExternalFlashPresent();
1.777 + settings->GetManualFlashPowerLevelsL(steps, info);
1.778 + settings->SetManualFlashPowerLevel(value);
1.779 + settings->ManualFlashPowerLevel();
1.780 +
1.781 + settings->SupportedExposureModes();
1.782 + settings->ExposureMode();
1.783 + settings->SetExposureMode(CCamera::EExposureAuto);
1.784 +
1.785 + settings->GetExposureCompensationStepsL(steps, info);
1.786 + TInt expCompensationStep1 = settings->ExposureCompensationStep();
1.787 + if(expCompensationStep1 != KExposureCompensationStep)
1.788 + {
1.789 + INFO_PRINTF2(_L("old method for ExposureCompensationStep retrieving wrong value %d"),expCompensationStep1);
1.790 + result = EFail;
1.791 + }
1.792 +
1.793 + TInt expCompensationStep2 = 0;
1.794 + err = settings->GetExposureCompensationStep(expCompensationStep2);
1.795 + if(expCompensationStep1 != expCompensationStep2)
1.796 + {
1.797 + INFO_PRINTF1(_L("old and new method for ExposureCompensationStep retrieving wrong/dissimilar values"));
1.798 + result = EFail;
1.799 + }
1.800 + if(err)
1.801 + {
1.802 + INFO_PRINTF2(_L("new method for ExposureCompensationStep had error %d"),err);
1.803 + result = EFail;
1.804 + }
1.805 + settings->SetExposureCompensationStep(value);
1.806 +
1.807 + settings->GetExposureCompensationRangeInSteps(negValue, posValue);
1.808 + TInt expCompensation1 = settings->ExposureCompensation();
1.809 + if(expCompensation1 != KExposureCompensationInSteps)
1.810 + {
1.811 + INFO_PRINTF2(_L("old method for ExposureCompensation retrieving wrong value %d"),expCompensation1);
1.812 + result = EFail;
1.813 + }
1.814 +
1.815 + TInt expCompensation2 = 0;
1.816 + err = settings->GetExposureCompensation(expCompensation2);
1.817 +
1.818 + if(expCompensation1 != expCompensation2)
1.819 + {
1.820 + INFO_PRINTF1(_L("old and new method for ExposureCompensation retrieving wrong/dissimilar values"));
1.821 + result = EFail;
1.822 + }
1.823 + if(err)
1.824 + {
1.825 + INFO_PRINTF2(_L("new method for ExposureCompensation had error %d"),err);
1.826 + result = EFail;
1.827 + }
1.828 + settings->SetExposureCompensation(value);
1.829 +
1.830 + settings->SupportedWhiteBalanceModes();
1.831 + settings->WhiteBalanceMode();
1.832 + settings->SetWhiteBalanceMode(CCamera::EWBAuto);
1.833 +
1.834 + settings->ShootClickOn();
1.835 + settings->SetShootClickOn(EFalse);
1.836 + settings->GetTimerIntervalsL(steps, info);
1.837 + settings->TimerInterval();
1.838 + settings->SetTimerInterval(value);
1.839 +
1.840 + TTime start;
1.841 + TTime end;
1.842 + TTime interval;
1.843 +
1.844 + settings->GetTimeLapsePeriodRange(start, end);
1.845 + settings->GetTimeLapse(start, end, interval);
1.846 + settings->SetTimeLapse(start, end, interval);
1.847 +
1.848 + settings->PictureOrientation();
1.849 + settings->SetPictureOrientation(CCamera::CCameraAdvancedSettings::EPictureOrientationPortrait);
1.850 +
1.851 + settings->SupportedPixelAspectRatios();
1.852 + settings->PixelAspectRatio();
1.853 + settings->SetPixelAspectRatio(CCamera::CCameraAdvancedSettings::EPixelAspect1To1);
1.854 + settings->SupportedYuvRanges();
1.855 + settings->YuvRange();
1.856 + settings->SetYuvRange(CCamera::CCameraAdvancedSettings::EYuvRangeVideoCropped);
1.857 + settings->BurstImages();
1.858 + settings->SetBurstImages(value);
1.859 + settings->GetOpticalZoomStepsL(steps, info);
1.860 + settings->OpticalZoom();
1.861 + settings->SetOpticalZoom(value);
1.862 + settings->GetDigitalZoomStepsL(steps, info);
1.863 + settings->DigitalZoom();
1.864 + settings->SetDigitalZoom(value);
1.865 +
1.866 + TInt sizeIndex =0;
1.867 + TBool isInfluencePossible;
1.868 + CCamera::TFormat format = CCamera::EFormatYUV420Planar;
1.869 + settings->GetDigitalZoomStepsForStillL(steps, info, sizeIndex, format, isInfluencePossible);
1.870 + settings->DigitalZoom();
1.871 + settings->SetDigitalZoom(value);
1.872 +
1.873 + TInt frameRateIndex =0;
1.874 + CCamera::TExposure exposure = CCamera::EExposureAuto;
1.875 + settings->GetDigitalZoomStepsForVideoL(steps, info, frameRateIndex, sizeIndex, format, isInfluencePossible, exposure);
1.876 + settings->DigitalZoom();
1.877 + settings->SetDigitalZoom(value);
1.878 +
1.879 + settings->ExposureLockOn();
1.880 + settings->SetExposureLockOn(EFalse);
1.881 + settings->AutoFocusLockOn();
1.882 + settings->SetAutoFocusLockOn(EFalse);
1.883 +
1.884 + // timeouts
1.885 + RArray<TInt> timeouts;
1.886 + settings->GetSupportedContinuousAutoFocusTimeoutsL(timeouts, info);
1.887 + timeouts.Close();
1.888 + settings->ContinuousAutoFocusTimeout();
1.889 + settings->SetContinuousAutoFocusTimeout(KContinuousAutoFocusTimeoutValue1);
1.890 +
1.891 + // stabilization effects
1.892 + settings->SupportedStabilizationEffects();
1.893 + settings->SetStabilizationEffect(CCamera::CCameraAdvancedSettings::EStabilizationAuto);
1.894 + CCamera::CCameraAdvancedSettings::TStabilizationEffect effect = settings->StabilizationEffect();
1.895 +
1.896 + // stabilization complexity
1.897 + settings->SupportedStabilizationComplexityValues();
1.898 + CCamera::CCameraAdvancedSettings::TStabilizationAlgorithmComplexity complexity = settings->StabilizationComplexity();
1.899 + settings->SetStabilizationComplexity(CCamera::CCameraAdvancedSettings::EStabilizationComplexityAuto);
1.900 +
1.901 + // ISO rate type
1.902 + iInputEventUid = KUidECamEventCameraSettingIsoRateType;
1.903 +
1.904 + supportedISORateTypes = 0;
1.905 + settings->GetSupportedISORateTypeL(supportedISORateTypes);
1.906 +
1.907 + INFO_PRINTF2(_L("CCameraAdvancedSettings supported Iso Rate Types 0x%x"), supportedISORateTypes);
1.908 +
1.909 + //List of supported ISO rates can be found using OLD API.
1.910 + RArray<TInt> supportedIsoRates;
1.911 + settings->GetSupportedIsoRatesL(supportedIsoRates);
1.912 +
1.913 + //set to manual ISO rate
1.914 + isoRateType = CCamera::CCameraAdvancedSettings::EISOManual;
1.915 + if(isoRateType & supportedISORateTypes)
1.916 + {
1.917 + INFO_PRINTF1(_L("Testing new ISO API for CCamera::CCameraAdvancedSettings::EISOManual"));
1.918 + TestISOTypesL(settings, isoRateType, supportedIsoRates, result);
1.919 + }
1.920 +
1.921 + //switch to unprioritised type of Auto ISO...
1.922 + isoRateType = CCamera::CCameraAdvancedSettings::EISOAutoUnPrioritised;
1.923 + if(isoRateType & supportedISORateTypes)
1.924 + {
1.925 + INFO_PRINTF1(_L("Testing new ISO API for CCamera::CCameraAdvancedSettings::EISOAutoUnPrioritised"));
1.926 + TestISOTypesL(settings, isoRateType, supportedIsoRates, result);
1.927 + }
1.928 +
1.929 + //switch to ISO prioritised AutoISO ...
1.930 + isoRateType = CCamera::CCameraAdvancedSettings::EISOAutoISOPrioritised;
1.931 + if(isoRateType & supportedISORateTypes)
1.932 + {
1.933 + INFO_PRINTF1(_L("Testing new ISO API for CCamera::CCameraAdvancedSettings::EISOAutoISOPrioritised"));
1.934 + TestISOTypesL(settings, isoRateType, supportedIsoRates, result);
1.935 + }
1.936 +
1.937 + //switch to shutter speed prioritised AutoISO...
1.938 + isoRateType = CCamera::CCameraAdvancedSettings::EISOAutoShutterSpeedPrioritised;
1.939 + if(isoRateType & supportedISORateTypes)
1.940 + {
1.941 + INFO_PRINTF1(_L("Testing new ISO API for CCamera::CCameraAdvancedSettings::EISOAutoShutterSpeedPrioritised"));
1.942 + TestISOTypesL(settings, isoRateType, supportedIsoRates, result);
1.943 + }
1.944 +
1.945 + //switch to aperture prioritised AutoISO...
1.946 + isoRateType = CCamera::CCameraAdvancedSettings::EISOAutoAperturePrioritised;
1.947 + if(isoRateType & supportedISORateTypes)
1.948 + {
1.949 + INFO_PRINTF1(_L("Testing new ISO API for CCamera::CCameraAdvancedSettings::EISOAutoAperturePrioritised"));
1.950 + TestISOTypesL(settings, isoRateType, supportedIsoRates, result);
1.951 + }
1.952 +
1.953 + supportedIsoRates.Close();
1.954 +
1.955 + // all functions are called, irrespective of the units; in real case will be one set or the other
1.956 + TRgb rgb(100,124,130);
1.957 + CCamera::CCameraAdvancedSettings::TWBUnits units = settings->SupportedWBUnits();
1.958 + settings->SetWBRgbValue(rgb);
1.959 + settings->GetWBRgbValue(rgb);
1.960 + RArray<TInt> temperatures;
1.961 + settings->GetWBSupportedColorTemperaturesL(temperatures, info);
1.962 + temperatures.Close();
1.963 + settings->SetWBColorTemperature(KWBColorTemperature1);
1.964 + TInt temp = settings->WBColorTemperature();
1.965 +
1.966 + INFO_PRINTF1(_L("GetFocalLengthInfoL method invocation"));
1.967 + TInt currentFocalLength=0;
1.968 + TInt maxFocalLength=0;
1.969 + TRAP(err, settings->GetFocalLengthInfoL(minFocalLength, currentFocalLength, maxFocalLength));
1.970 + if(err != KErrNotSupported)
1.971 + {
1.972 + INFO_PRINTF1(_L("GetFocalLengthInfoL supported!"));
1.973 + result = EFail;
1.974 + }
1.975 +
1.976 + INFO_PRINTF1(_L("GetNumOperationPreferenceL method invocation"));
1.977 + TUint numOperationPreferenceSupported=0;
1.978 + TRAP(err, settings->GetNumOperationPreferenceL(numOperationPreferenceSupported));
1.979 + if(err != KErrNotSupported)
1.980 + {
1.981 + INFO_PRINTF1(_L("GetNumOperationPreferenceL supported!"));
1.982 + result = EFail;
1.983 + }
1.984 +
1.985 + INFO_PRINTF1(_L("EnumerateOperationPreferenceL method invocation"));
1.986 +
1.987 + TUint operationPreferenceIndex=0;
1.988 + CCamera::CCameraAdvancedSettings::TPerformanceLevel speedLevel =
1.989 + CCamera::CCameraAdvancedSettings::ELevelDontCare;
1.990 + CCamera::CCameraAdvancedSettings::TPerformanceLevel qualityLevel =
1.991 + CCamera::CCameraAdvancedSettings::ELevelDontCare;
1.992 + CCamera::CCameraAdvancedSettings::TPerformanceLevel lowMemoryConsumptionLevel =
1.993 + CCamera::CCameraAdvancedSettings::ELevelDontCare;
1.994 + CCamera::CCameraAdvancedSettings::TPerformanceLevel lowPowerConsumptionLevel =
1.995 + CCamera::CCameraAdvancedSettings::ELevelDontCare;
1.996 +
1.997 + TRAP(err, settings->EnumerateOperationPreferenceL(operationPreferenceIndex, speedLevel,
1.998 + qualityLevel, lowMemoryConsumptionLevel, lowPowerConsumptionLevel));
1.999 + if(err != KErrNotSupported)
1.1000 + {
1.1001 + INFO_PRINTF1(_L("EnumerateOperationPreferenceL supported!"));
1.1002 + result = EFail;
1.1003 + }
1.1004 +
1.1005 + iInputEventUid = KUidECamEventCameraSettingOperationPreference;
1.1006 + settings->SetOperationPreferenceL(operationPreferenceIndex);
1.1007 + CheckNotificationNeg(iInputEventUid, result);
1.1008 +
1.1009 + INFO_PRINTF1(_L("GetOperationPreferenceL method invocation"));
1.1010 + TInt opPreferenceIndex;
1.1011 + TRAP(err, settings->GetOperationPreferenceL(opPreferenceIndex));
1.1012 + if(err != KErrNotSupported)
1.1013 + {
1.1014 + INFO_PRINTF1(_L("GetOperationPreferenceL supported!"));
1.1015 + result = EFail;
1.1016 + }
1.1017 +
1.1018 + INFO_PRINTF1(_L("GetSupportedEventsL method invocation"));
1.1019 + RArray<TUid> supportedEvents;
1.1020 + settings->GetSupportedEventsL(supportedEvents);
1.1021 +
1.1022 + if(supportedEvents.Count() != 0)
1.1023 + {
1.1024 + INFO_PRINTF1(_L("GetSupportedEventsL entry exists!"));
1.1025 + result = EFail;
1.1026 + }
1.1027 + supportedEvents.Close();
1.1028 +
1.1029 + INFO_PRINTF1(_L("GetIndirectFeatureChangesL method invocation"));
1.1030 + RArray<TUid> featureChangesIndirect;
1.1031 + TRAP(err, settings->GetIndirectFeatureChangesL(KUidECamEventCameraSettingOperationPreference, featureChangesIndirect));
1.1032 + if(err != KErrNone)
1.1033 + {
1.1034 + INFO_PRINTF1(_L("GetIndirectFeatureChangesL returned error!"));
1.1035 + result = EFail;
1.1036 + }
1.1037 +
1.1038 + if(featureChangesIndirect.Count() != 0)
1.1039 + {
1.1040 + INFO_PRINTF1(_L("GetIndirectFeatureChangesL entry exists!"));
1.1041 + result = EFail;
1.1042 + }
1.1043 + featureChangesIndirect.Close();
1.1044 +
1.1045 + CleanupStack::PopAndDestroy(settings);
1.1046 + }
1.1047 + else
1.1048 + {
1.1049 + result = EFail;
1.1050 + User::Leave(KErrNoMemory);
1.1051 + }
1.1052 + CleanupStack::PopAndDestroy(camera);
1.1053 + }
1.1054 + else
1.1055 + {
1.1056 + INFO_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
1.1057 + result = EFail;
1.1058 + User::Leave(KErrNoMemory);
1.1059 + }
1.1060 + __MM_HEAP_MARKEND;
1.1061 +
1.1062 + return result;
1.1063 + }
1.1064 +
1.1065 +
1.1066 +void RECamAdvSetDefaultsTest::TestISOTypesL(CCamera::CCameraAdvancedSettings* aSettings, CCamera::CCameraAdvancedSettings::TISORateType aIsoRateType, RArray<TInt> aSupportedIsoRates, TVerdict& aResult)
1.1067 + {
1.1068 + TInt param =0;
1.1069 +
1.1070 + switch(aIsoRateType)
1.1071 + {
1.1072 + case CCamera::CCameraAdvancedSettings::EISOManual:
1.1073 + {
1.1074 + param = KDefaultIsoRating;
1.1075 + break;
1.1076 + }
1.1077 +
1.1078 + case CCamera::CCameraAdvancedSettings::EISOAutoISOPrioritised:
1.1079 + {
1.1080 + param = KIsoRate01;// ISO rate equal to or closest to (and less than) it should be selected by the
1.1081 + // camera in order to get optimum exposure.
1.1082 + break;
1.1083 + }
1.1084 +
1.1085 + case CCamera::CCameraAdvancedSettings::EISOAutoShutterSpeedPrioritised:
1.1086 + {
1.1087 + param = KShutterSpeed;// Shutter speed equal to or closest to (and faster than) it should be selected by the
1.1088 + // camera in order to get optimum exposure.
1.1089 + break;
1.1090 + }
1.1091 +
1.1092 + case CCamera::CCameraAdvancedSettings::EISOAutoAperturePrioritised:
1.1093 + {
1.1094 + param = KDefaultAperture;// Aperture opening equal to or closest to (and wider than) it should be selected by the
1.1095 + // camera in order to get optimum exposure.
1.1096 + break;
1.1097 + }
1.1098 +
1.1099 + default:
1.1100 + {
1.1101 + param =0;
1.1102 + }
1.1103 + }
1.1104 +
1.1105 + aSettings->SetISORateL(aIsoRateType, param);
1.1106 +
1.1107 + CheckNotification(iInputEventUid, aResult);
1.1108 +
1.1109 + CCamera::CCameraAdvancedSettings::TISORateType retrievedIsoRateType;
1.1110 + TInt retrievedParam =0;
1.1111 + TInt retrievedIsoRate =0;
1.1112 +
1.1113 + aSettings->GetISORateL(retrievedIsoRateType, retrievedParam, retrievedIsoRate);
1.1114 +
1.1115 + if(retrievedIsoRateType != aIsoRateType)
1.1116 + {
1.1117 + INFO_PRINTF3(_L("CCameraAdvancedSettings Iso Rate Type 0x%x is not as expected 0x%x"),
1.1118 + retrievedIsoRateType, aIsoRateType);
1.1119 + aResult = EFail;
1.1120 + }
1.1121 +
1.1122 + if(aIsoRateType & KAutoISOTypes)
1.1123 + {
1.1124 + if(retrievedParam != param)
1.1125 + {
1.1126 + INFO_PRINTF3(_L("CCameraAdvancedSettings Auto ISO parameter %d is not as expected %d"),
1.1127 + retrievedParam, param);
1.1128 + aResult = EFail;
1.1129 + }
1.1130 +
1.1131 + if(retrievedIsoRate == KErrNotFound)
1.1132 + {
1.1133 + INFO_PRINTF2(_L("CCameraAdvancedSettings retrieved Iso Rate: %d :- Camera incapable of getting ISO under Auto ISO"),
1.1134 + retrievedIsoRate);
1.1135 + }
1.1136 + else
1.1137 + {//ISO set under Auto ISO has to be one of supported ISO rates .
1.1138 + if (aSupportedIsoRates.Find(retrievedIsoRate) == KErrNotFound)
1.1139 + {
1.1140 + INFO_PRINTF2(_L("CCameraAdvancedSettings Iso Rate %d is not among the supported ISO rates"),
1.1141 + retrievedIsoRate);
1.1142 + aResult = EFail;
1.1143 + }
1.1144 +
1.1145 +
1.1146 + if(aIsoRateType == CCamera::CCameraAdvancedSettings::EISOAutoISOPrioritised)
1.1147 + {
1.1148 + //ISO rate set should be less than or equal to param
1.1149 + if (retrievedIsoRate > param)
1.1150 + {
1.1151 + INFO_PRINTF3(_L("CCameraAdvancedSettings Iso Rate %d is greater than %d"),
1.1152 + retrievedIsoRate, param);
1.1153 + aResult = EFail;
1.1154 + }
1.1155 + }
1.1156 +
1.1157 + //use of old API
1.1158 + TInt retrievedIsoRateOld = aSettings->IsoRate();
1.1159 + if (retrievedIsoRateOld != retrievedIsoRate)
1.1160 + {
1.1161 + INFO_PRINTF3(_L("CCameraAdvancedSettings OLD and NEW API inconsistent: Iso Rate old %d ; ISO Rate new: %d"),
1.1162 + retrievedIsoRateOld, retrievedIsoRate);
1.1163 + aResult = EFail;
1.1164 + }
1.1165 + }
1.1166 +
1.1167 + //switch to manual ISO using OLD API
1.1168 + aSettings->SetIsoRate(KDefaultIsoRating);
1.1169 +
1.1170 + aSettings->GetISORateL(retrievedIsoRateType, param, retrievedIsoRate);
1.1171 +
1.1172 + if(retrievedIsoRateType != CCamera::CCameraAdvancedSettings::EISOManual)
1.1173 + {
1.1174 + INFO_PRINTF3(_L("CCameraAdvancedSettings Iso Rate Type 0x%x is not as expected 0x%x : OLD and NEW API inconsistent"),
1.1175 + retrievedIsoRateType, CCamera::CCameraAdvancedSettings::EISOManual);
1.1176 + aResult = EFail;
1.1177 + }
1.1178 +
1.1179 + if (retrievedIsoRate != KDefaultIsoRating)
1.1180 + {
1.1181 + INFO_PRINTF3(_L("CCameraAdvancedSettings Iso Rate %d is not as expected %d"),
1.1182 + retrievedIsoRate, KDefaultIsoRating);
1.1183 + aResult = EFail;
1.1184 + }
1.1185 + }
1.1186 +
1.1187 + //use of old API
1.1188 + TInt retrievedIsoRateOld = aSettings->IsoRate();
1.1189 + if (retrievedIsoRateOld != retrievedIsoRate)
1.1190 + {
1.1191 + INFO_PRINTF3(_L("CCameraAdvancedSettings OLD and NEW API inconsistent: Iso Rate old %d ; ISO Rate new: %d"),
1.1192 + retrievedIsoRateOld, retrievedIsoRate);
1.1193 + aResult = EFail;
1.1194 + }
1.1195 + }
1.1196 +
1.1197 +//
1.1198 +// RECamAdvSetGettersTest //
1.1199 +//
1.1200 +RECamAdvSetGettersTest* RECamAdvSetGettersTest::NewL(TBool aAllocTest)
1.1201 + {
1.1202 + RECamAdvSetGettersTest* self = new (ELeave) RECamAdvSetGettersTest(aAllocTest);
1.1203 + return self;
1.1204 + }
1.1205 +
1.1206 +RECamAdvSetGettersTest::RECamAdvSetGettersTest(TBool /*aAllocTest*/)
1.1207 + {
1.1208 + iTestStepName = _L("MM-ECM-ADV-U-011-HP");
1.1209 + }
1.1210 +
1.1211 +TVerdict RECamAdvSetGettersTest::DoTestStepL()
1.1212 + {
1.1213 + TVerdict result = EPass;
1.1214 + CCamera* camera = NULL;
1.1215 +
1.1216 + TInt error = KErrNone;
1.1217 + CCamera::CCameraAdvancedSettings* settings = NULL;
1.1218 +
1.1219 + __MM_HEAP_MARK;
1.1220 + INFO_PRINTF1(_L("Create camera using Camera::New2L() and MCameraObserver2"));
1.1221 + TRAP(error, camera = CCamera::New2L(*this, 0,0));
1.1222 +
1.1223 + if (error==KErrNone)
1.1224 + {
1.1225 + CleanupStack::PushL(camera);
1.1226 + INFO_PRINTF1(_L("Create advanced settings from CCamera object"));
1.1227 + settings = static_cast<CCamera::CCameraAdvancedSettings*> (camera->CustomInterface(KECamAdvancedSettingUid));
1.1228 + if (settings!= NULL)
1.1229 + {
1.1230 + CleanupStack::PushL(settings);
1.1231 +
1.1232 + iInputEventUid = KUidECamEventCameraSettingIsoRate;
1.1233 + TInt isoRateSet = KIsoRate01;
1.1234 + settings->SetIsoRate(isoRateSet);
1.1235 + INFO_PRINTF2(_L("CCameraAdvancedSettings Iso Rate set %d"), isoRateSet);
1.1236 +
1.1237 + CheckNotification(iInputEventUid, result);
1.1238 +
1.1239 + // Get ISO rate. It should have changed to set value.
1.1240 + TInt isoRate = settings->IsoRate();
1.1241 + INFO_PRINTF2(_L("CCameraAdvancedSettings get Iso Rate %d"), isoRate);
1.1242 +
1.1243 + if (isoRateSet!=isoRate)
1.1244 + {
1.1245 + INFO_PRINTF1(_L("Got a different iso rate than it was set"));
1.1246 + result = EFail;
1.1247 + }
1.1248 +
1.1249 + CleanupStack::PopAndDestroy(settings);
1.1250 + }
1.1251 + else
1.1252 + {
1.1253 + result = EFail;
1.1254 + }
1.1255 + CleanupStack::PopAndDestroy(camera);
1.1256 + }
1.1257 + else
1.1258 + {
1.1259 + INFO_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
1.1260 + result = EFail;
1.1261 + }
1.1262 + __MM_HEAP_MARKEND;
1.1263 +
1.1264 + return result;
1.1265 + }
1.1266 +
1.1267 +
1.1268 +//
1.1269 +// RECamAdvSetTwoCamTest //
1.1270 +//
1.1271 +RECamAdvSetTwoCamTest* RECamAdvSetTwoCamTest::NewL(TBool aAllocTest)
1.1272 + {
1.1273 + RECamAdvSetTwoCamTest* self = new (ELeave) RECamAdvSetTwoCamTest(aAllocTest);
1.1274 + return self;
1.1275 + }
1.1276 +
1.1277 +RECamAdvSetTwoCamTest::RECamAdvSetTwoCamTest(TBool /*aAllocTest*/)
1.1278 + {
1.1279 + iTestStepName = _L("MM-ECM-ADV-U-014-HP");
1.1280 + }
1.1281 +
1.1282 +TVerdict RECamAdvSetTwoCamTest::DoTestStepL()
1.1283 + {
1.1284 + TVerdict result = EPass;
1.1285 + CCamera* camera1 = NULL;
1.1286 + CCamera* camera2 = NULL;
1.1287 +
1.1288 + TInt error = KErrNone;
1.1289 + CCamera::CCameraAdvancedSettings* settings1 = NULL;
1.1290 + CCamera::CCameraAdvancedSettings* settings2 = NULL;
1.1291 +
1.1292 + // using observer 2 if exist
1.1293 + MCameraObserver2* observer2 = NULL;
1.1294 +
1.1295 + __MM_HEAP_MARK;
1.1296 + INFO_PRINTF1(_L("Create camera using Camera::New2L() and MCameraObserver2"));
1.1297 + TRAP(error, camera1 = CCamera::New2L(*this, 0,0));
1.1298 + if (error==KErrNone)
1.1299 + {
1.1300 + CleanupStack::PushL(camera1);
1.1301 + TRAP(error, camera2 = CCamera::New2L(*observer2, 1,0));
1.1302 +
1.1303 + if (error==KErrNone)
1.1304 + {
1.1305 + CleanupStack::PushL(camera2);
1.1306 + //Second camera
1.1307 + settings1 = static_cast<CCamera::CCameraAdvancedSettings*> (camera1->CustomInterface(KECamAdvancedSettingUid));
1.1308 + RArray<TUid> aSuppSettings1;
1.1309 + RArray<TUid> aActSettings1;
1.1310 + if (settings1!= NULL)
1.1311 + {
1.1312 + CleanupStack::PushL(settings1);
1.1313 +
1.1314 + CleanupClosePushL(aSuppSettings1);
1.1315 + aSuppSettings1.Reset();
1.1316 + settings1->GetSupportedSettingsL(aSuppSettings1);
1.1317 + CleanupClosePushL(aActSettings1);
1.1318 + aActSettings1.Reset();
1.1319 + settings1->GetActiveSettingsL(aActSettings1);
1.1320 + if ((aActSettings1.Count())==0)
1.1321 + {
1.1322 + INFO_PRINTF1(_L("Active camera. Non empty array expected"));
1.1323 + result = EFail;
1.1324 + }
1.1325 +
1.1326 + settings1->GetDisabledSettingsL(aActSettings1);
1.1327 + }
1.1328 +
1.1329 + //Second camera
1.1330 + settings2 = static_cast<CCamera::CCameraAdvancedSettings*> (camera2->CustomInterface(KECamAdvancedSettingUid));
1.1331 + RArray<TUid> aSuppSettings2;
1.1332 + RArray<TUid> aActSettings2;
1.1333 + if (settings2!= NULL)
1.1334 + {
1.1335 + CleanupStack::PushL(settings2);
1.1336 +
1.1337 + CleanupClosePushL(aSuppSettings2);
1.1338 + aSuppSettings2.Reset();
1.1339 + settings2->GetSupportedSettingsL(aSuppSettings2);
1.1340 + CleanupClosePushL(aActSettings2);
1.1341 + aActSettings2.Reset();
1.1342 + settings2->GetActiveSettingsL(aActSettings2);
1.1343 + if ((aActSettings2.Count())!=0)
1.1344 + {
1.1345 + INFO_PRINTF1(_L("Empty array expected (non present camera)"));
1.1346 + result = EFail;
1.1347 + }
1.1348 + }
1.1349 +
1.1350 + CleanupStack::PopAndDestroy(2, &aSuppSettings2); //aActSettings2
1.1351 + CleanupStack::PopAndDestroy(settings2);
1.1352 +
1.1353 + CleanupStack::PopAndDestroy(2, &aSuppSettings1); //aActSettings1
1.1354 + CleanupStack::PopAndDestroy(settings1);
1.1355 +
1.1356 + CleanupStack::PopAndDestroy(camera2);
1.1357 +
1.1358 + }
1.1359 + else
1.1360 + {
1.1361 + INFO_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
1.1362 + result = EFail;
1.1363 + }
1.1364 +
1.1365 + CleanupStack::PopAndDestroy(camera1);
1.1366 +
1.1367 + }
1.1368 + else
1.1369 + {
1.1370 + INFO_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
1.1371 + result = EFail;
1.1372 + }
1.1373 + __MM_HEAP_MARKEND;
1.1374 +
1.1375 + return result;
1.1376 + }
1.1377 +
1.1378 +//
1.1379 +// RECamAdvSetNegTest //
1.1380 +//
1.1381 +
1.1382 +RECamAdvSetNegTest* RECamAdvSetNegTest::NewL(TBool aAllocTest)
1.1383 + {
1.1384 + RECamAdvSetNegTest* self = new (ELeave) RECamAdvSetNegTest(aAllocTest);
1.1385 + return self;
1.1386 + }
1.1387 +
1.1388 +RECamAdvSetNegTest::RECamAdvSetNegTest(TBool /*aAllocTest*/)
1.1389 + {
1.1390 + iTestStepName = _L("MM-ECM-ADV-U-0102-HP");
1.1391 + }
1.1392 +
1.1393 +TVerdict RECamAdvSetNegTest::DoTestStepL()
1.1394 + {
1.1395 + TVerdict result = EPass;
1.1396 + CCamera* camera = NULL;
1.1397 +
1.1398 + TInt error = KErrNone;
1.1399 + CCamera::CCameraAdvancedSettings* settings = NULL;
1.1400 +
1.1401 + __MM_HEAP_MARK;
1.1402 + INFO_PRINTF1(_L("Create camera using Camera::New2L() and MCameraObserver2"));
1.1403 + TRAP(error, camera = CCamera::New2L(*this,0,0));
1.1404 +
1.1405 + if (error==KErrNone)
1.1406 + {
1.1407 + CleanupStack::PushL(camera);
1.1408 + INFO_PRINTF1(_L("Create advanced settings from CCamera object"));
1.1409 + settings = static_cast<CCamera::CCameraAdvancedSettings*> (camera->CustomInterface(KECamAdvancedSettingUid));
1.1410 + if (settings!= NULL)
1.1411 + {
1.1412 + CleanupStack::PushL(settings);
1.1413 + // trying to set a value which is not supported
1.1414 + // the action would fail to set a new value and the notification will fail
1.1415 + // thus the current value will be different from the requested value. - double verification
1.1416 + iInputEventUid = KUidECamEventCameraSettingIsoRate;
1.1417 + TInt isoRateSet = KIsoRate0; // not supported rate
1.1418 + settings->SetIsoRate(isoRateSet);
1.1419 + INFO_PRINTF2(_L("CCameraAdvancedSettings Iso Rate set 0x%x"), isoRateSet);
1.1420 +
1.1421 + CheckNotificationNeg(iInputEventUid, result);
1.1422 +
1.1423 + // Get ISO rate. It should have changed to set value.
1.1424 + TInt isoRate = settings->IsoRate();
1.1425 + INFO_PRINTF2(_L("CCameraAdvancedSettings get Iso Rate 0x%x"), isoRate);
1.1426 + if (isoRateSet == isoRate)
1.1427 + {
1.1428 + INFO_PRINTF1(_L("Got an unsupported iso rate set"));
1.1429 + result = EFail;
1.1430 + }
1.1431 +
1.1432 + // Check the new API for ISO setting as well.
1.1433 + iInputEventUid = KUidECamEventCameraSettingIsoRateType;
1.1434 +
1.1435 + settings->SetISORateL(CCamera::CCameraAdvancedSettings::EISOManual, isoRateSet);
1.1436 + INFO_PRINTF2(_L("CCameraAdvancedSettings Iso Rate set 0x%x"), isoRateSet);
1.1437 +
1.1438 + CheckNotificationNeg(iInputEventUid, result);
1.1439 +
1.1440 + // Get ISO rate. It should have changed to set value.
1.1441 + CCamera::CCameraAdvancedSettings::TISORateType isoRateType = CCamera::CCameraAdvancedSettings::EISOManual;
1.1442 + TInt index =0;
1.1443 + settings->GetISORateL(isoRateType, index, isoRate);
1.1444 + INFO_PRINTF2(_L("CCameraAdvancedSettings get Iso Rate 0x%x"), isoRate);
1.1445 + if (isoRateSet == isoRate)
1.1446 + {
1.1447 + INFO_PRINTF1(_L("Got an unsupported iso rate set"));
1.1448 + result = EFail;
1.1449 + }
1.1450 +
1.1451 + CleanupStack::PopAndDestroy(settings);
1.1452 + }
1.1453 + else
1.1454 + {
1.1455 + result = EFail;
1.1456 + }
1.1457 + CleanupStack::PopAndDestroy(camera);
1.1458 + }
1.1459 + else
1.1460 + {
1.1461 + INFO_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
1.1462 + result = EFail;
1.1463 + }
1.1464 + __MM_HEAP_MARKEND;
1.1465 +
1.1466 + return result;
1.1467 + }
1.1468 +
1.1469 +//
1.1470 +// RECamAdvSetBaselineTest //
1.1471 +//
1.1472 +RECamAdvSetBaselineTest* RECamAdvSetBaselineTest::NewL(TBool aAllocTest)
1.1473 + {
1.1474 + RECamAdvSetBaselineTest* self = new (ELeave) RECamAdvSetBaselineTest(aAllocTest);
1.1475 + return self;
1.1476 + }
1.1477 +
1.1478 +RECamAdvSetBaselineTest::RECamAdvSetBaselineTest(TBool)
1.1479 + {
1.1480 + iTestStepName = _L("MM-ECM-ADV-U-048-HP");
1.1481 + }
1.1482 +
1.1483 +TVerdict RECamAdvSetBaselineTest::DoTestStepL()
1.1484 + {
1.1485 + TVerdict result = EPass;
1.1486 + CCamera* camera = NULL;
1.1487 +
1.1488 + TInt error = KErrNone;
1.1489 + CCamera::CCameraAdvancedSettings* settings = NULL;
1.1490 +
1.1491 + __MM_HEAP_MARK;
1.1492 + INFO_PRINTF1(_L("Create camera using Camera::NewL() and MCameraObserver2"));
1.1493 + TRAP(error, camera = CCamera::NewL(*this, 0,0));
1.1494 + if (error==KErrNone)
1.1495 + {
1.1496 + CleanupStack::PushL(camera);
1.1497 + INFO_PRINTF1(_L("Create advanced settings from CCamera object"));
1.1498 + settings = static_cast<CCamera::CCameraAdvancedSettings*> (camera->CustomInterface(KECamAdvancedSettingUid));
1.1499 + if (settings!= NULL)
1.1500 + {
1.1501 + CleanupStack::PushL(settings);
1.1502 +
1.1503 + // Supported Focus Range. Set unfamilar Focus Range. Get a known Focus Range.
1.1504 + iInputEventUid = KUidECamEventCameraSettingFocusRange;
1.1505 + TInt suppFocusRanges = settings->SupportedFocusRanges();
1.1506 + INFO_PRINTF2(_L("CCameraAdvancedSettings supported Focus Ranges 0x%x"), suppFocusRanges);
1.1507 + if(suppFocusRanges > KBaselinedFocusRanges)
1.1508 + {
1.1509 + INFO_PRINTF1(_L("Unfamiliar focus range received"));
1.1510 + result = EFail;
1.1511 + }
1.1512 +
1.1513 + CCamera::CCameraAdvancedSettings::TFocusRange unfamilarFocusRange = CCamera::CCameraAdvancedSettings::EFocusRangeHyperfocal;
1.1514 + settings->SetFocusRange(unfamilarFocusRange);
1.1515 +
1.1516 + // Check for KUidECamEventCameraSettingFocusRange.
1.1517 + CheckNotification(iInputEventUid, result);
1.1518 +
1.1519 + CCamera::CCameraAdvancedSettings::TFocusRange retrievedFocusRange = settings->FocusRange();
1.1520 + if (CCamera::CCameraAdvancedSettings::EFocusRangeAuto != retrievedFocusRange)
1.1521 + {
1.1522 + INFO_PRINTF1(_L("CCameraAdvancedSettings retrieved unfamilar/wrong Focus Range"));
1.1523 + result = EFail;
1.1524 + }
1.1525 +
1.1526 + // Supported White Balance Modes. Set unfamilar White Balance. Get a known White Balance.
1.1527 + iInputEventUid = KUidECamEventCameraSettingsWBValue;
1.1528 + TInt suppWhiteBalance = settings->SupportedWhiteBalanceModes();
1.1529 + INFO_PRINTF2(_L("CCameraAdvancedSettings supported White Balance 0x%x"), suppWhiteBalance);
1.1530 + if(suppWhiteBalance > KBaselinedWhiteBalanceModes)
1.1531 + {
1.1532 + INFO_PRINTF1(_L("Unfamiliar White Balance received"));
1.1533 + result = EFail;
1.1534 + }
1.1535 +
1.1536 + CCamera::TWhiteBalance unfamilarWhiteBalance = CCamera::EWBDaylightUnderWater;
1.1537 + settings->SetWhiteBalanceMode(unfamilarWhiteBalance);
1.1538 +
1.1539 + // Check for KUidECamEventCameraSettingsWBValue.
1.1540 + CheckNotification(iInputEventUid, result);
1.1541 +
1.1542 + CCamera::TWhiteBalance retrievedWhiteBalance = settings->WhiteBalanceMode();
1.1543 + if (CCamera::EWBAuto != retrievedWhiteBalance)
1.1544 + {
1.1545 + INFO_PRINTF1(_L("CCameraAdvancedSettings retrieved unfamilar/wrong WhiteBalance"));
1.1546 + result = EFail;
1.1547 + }
1.1548 +
1.1549 + RArray<TUid> settingsList;
1.1550 + CleanupClosePushL(settingsList);
1.1551 + // check for GetSupportedSettings
1.1552 + settings->GetSupportedSettingsL(settingsList);
1.1553 +
1.1554 + for(TInt index=0; index<settingsList.Count(); index++)
1.1555 + {
1.1556 + if(settingsList[index].iUid > KUidECamEventCameraSettingAutoFocusType2UidValue)
1.1557 + {
1.1558 + INFO_PRINTF1(_L("CCameraAdvancedSettings retrieved unfamilar settings"));
1.1559 + result = EFail;
1.1560 + }
1.1561 + }
1.1562 + settingsList.Reset();
1.1563 +
1.1564 + // check for GetActiveSettings
1.1565 + settings->GetActiveSettingsL(settingsList);
1.1566 +
1.1567 + for(TInt index=0; index<settingsList.Count(); index++)
1.1568 + {
1.1569 + if(settingsList[index].iUid > KUidECamEventCameraSettingAutoFocusType2UidValue)
1.1570 + {
1.1571 + INFO_PRINTF1(_L("CCameraAdvancedSettings retrieved unfamilar settings"));
1.1572 + result = EFail;
1.1573 + }
1.1574 + }
1.1575 + settingsList.Reset();
1.1576 +
1.1577 + // check for GetDisabledSettings
1.1578 + settings->GetDisabledSettingsL(settingsList);
1.1579 +
1.1580 + for(TInt index=0; index<settingsList.Count(); index++)
1.1581 + {
1.1582 + if(settingsList[index].iUid > KUidECamEventCameraSettingAutoFocusType2UidValue)
1.1583 + {
1.1584 + INFO_PRINTF1(_L("CCameraAdvancedSettings retrieved unfamilar settings"));
1.1585 + result = EFail;
1.1586 + }
1.1587 + }
1.1588 + settingsList.Reset();
1.1589 +
1.1590 + // check for PRECaptureWarning
1.1591 + TInt preCaptureWarningSupported = KAllPreCaptureWarnings; // ( = 0x3FFF)
1.1592 + settings->GetPreCaptureWarningSupportedL(CCamera::CCameraAdvancedSettings::EModeIdle, preCaptureWarningSupported);
1.1593 + if(preCaptureWarningSupported != ((CCamera::CCameraAdvancedSettings::EPCWGeneralWarning << 1)-1))
1.1594 + {
1.1595 + INFO_PRINTF1(_L("CCameraAdvancedSettings retrieved unfamilar preCaptureWarningSupported"));
1.1596 + result = EFail;
1.1597 + }
1.1598 +
1.1599 + // subscribe for pre capture warnings. Poll for it. Unsubscribe for Pre capture warning.
1.1600 + settings->SubscribeToPreCaptureWarningL(preCaptureWarningSupported);
1.1601 +
1.1602 + //Poll to know the status of every possible warning ...
1.1603 + TInt warningStatus = preCaptureWarningSupported;
1.1604 + settings->GetPreCaptureWarningL(warningStatus);
1.1605 + if(warningStatus != ((CCamera::CCameraAdvancedSettings::EPCWGeneralWarning << 1)-1))
1.1606 + {
1.1607 + INFO_PRINTF1(_L("CCameraAdvancedSettings retrieved unfamilar PreCaptureWarning"));
1.1608 + result = EFail;
1.1609 + }
1.1610 +
1.1611 + settings->UnSubscribePreCaptureWarningL();
1.1612 +
1.1613 + CleanupStack::PopAndDestroy(&settingsList);
1.1614 + CleanupStack::PopAndDestroy(settings);
1.1615 + }
1.1616 + else
1.1617 + {
1.1618 + result = EFail;
1.1619 + }
1.1620 + CleanupStack::PopAndDestroy(camera);
1.1621 + }
1.1622 + else
1.1623 + {
1.1624 + INFO_PRINTF2(_L("Unexpected %d return from CCamera::NewL(): observer 2"), error);
1.1625 + result = EFail;
1.1626 + }
1.1627 + __MM_HEAP_MARKEND;
1.1628 +
1.1629 + return result;
1.1630 + }
1.1631 +
1.1632 +class TDummyObserver: public MCameraObserver2
1.1633 + {
1.1634 +public:
1.1635 + explicit TDummyObserver(TInt& aErrorPointer);
1.1636 +
1.1637 + virtual void HandleEvent(const TECAMEvent& aEvent);
1.1638 + virtual void ViewFinderReady(MCameraBuffer& aCameraBuffer,TInt aError);
1.1639 + virtual void ImageBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
1.1640 + virtual void VideoBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
1.1641 +
1.1642 +private:
1.1643 + TInt& iErrorPointer;
1.1644 + };
1.1645 +
1.1646 +TDummyObserver::TDummyObserver(TInt& aErrorPointer):iErrorPointer(aErrorPointer)
1.1647 + {
1.1648 + }
1.1649 +
1.1650 +void TDummyObserver::HandleEvent(const TECAMEvent& /*aEvent*/)
1.1651 + {
1.1652 + return;
1.1653 + }
1.1654 +
1.1655 +void TDummyObserver::ViewFinderReady(MCameraBuffer& /*aCameraBuffer*/, TInt aError)
1.1656 + {
1.1657 + iErrorPointer = aError;
1.1658 + }
1.1659 +
1.1660 +void TDummyObserver::ImageBufferReady(MCameraBuffer& /*aCameraBuffer*/, TInt aError)
1.1661 + {
1.1662 + iErrorPointer = aError;
1.1663 + }
1.1664 +
1.1665 +void TDummyObserver::VideoBufferReady(MCameraBuffer& /*aCameraBuffer*/,TInt aError)
1.1666 + {
1.1667 + iErrorPointer = aError;
1.1668 + }
1.1669 +
1.1670 +RECamAdvSetTest2* RECamAdvSetTest2::NewL(TBool aAllocTest)
1.1671 + {
1.1672 + RECamAdvSetTest2* self = new (ELeave) RECamAdvSetTest2(aAllocTest);
1.1673 + return self;
1.1674 + }
1.1675 +
1.1676 +RECamAdvSetTest2::RECamAdvSetTest2(TBool /*aAllocTest*/)
1.1677 + {
1.1678 + iTestStepName = _L("MM-ECM-ADV-U-049-HP");
1.1679 + }
1.1680 +
1.1681 +void RECamAdvSetTest2::RatioSubStepL(CCamera::CCameraAdvancedSettings* settings, TInt aSuppRange, TInt aTestValue, TInt aExpValue)
1.1682 + {
1.1683 +// Pixel ratio's //
1.1684 + TInt suppRatios = settings->SupportedPixelAspectRatios();
1.1685 + if (suppRatios != aSuppRange)
1.1686 + {
1.1687 + INFO_PRINTF2(_L("--Error: Supported pixel ratios are wrong %x "), suppRatios);
1.1688 + User::Leave(KErrGeneral);
1.1689 + }
1.1690 + settings->SetPixelAspectRatio( CCamera::CCameraAdvancedSettings::TPixelAspectRatio(aTestValue) );
1.1691 +
1.1692 + TInt ratio = settings->PixelAspectRatio();
1.1693 +
1.1694 + if (ratio != aExpValue)
1.1695 + {
1.1696 + INFO_PRINTF2(_L("--Error: Returned ration is wrong %x "), ratio);
1.1697 + User::Leave(KErrGeneral);
1.1698 + }
1.1699 + }
1.1700 +
1.1701 +void RECamAdvSetTest2::FlashSubStepL(CCamera::CCameraAdvancedSettings* settings, TInt aSuppRange, TInt aTestValue, TInt aExpValue)
1.1702 + {
1.1703 +// Flash modes //
1.1704 + TInt suppFlashModes = settings->SupportedFlashModes();
1.1705 +
1.1706 + if (suppFlashModes != aSuppRange)
1.1707 + {
1.1708 + INFO_PRINTF2(_L("--Error: Supported flash modes are wrong %x "), suppFlashModes);
1.1709 + User::Leave(KErrGeneral);
1.1710 + }
1.1711 + settings->SetFlashMode( CCamera::TFlash(aTestValue) );
1.1712 +
1.1713 + TInt flashMode = settings->FlashMode();
1.1714 +
1.1715 + if (flashMode != aExpValue)
1.1716 + {
1.1717 + INFO_PRINTF2(_L("--Error: Returned flash mode is wrong %x "), flashMode);
1.1718 + User::Leave(KErrGeneral);
1.1719 + }
1.1720 + }
1.1721 +
1.1722 +void RECamAdvSetTest2::OvrSubStepL(CCamera& aCamera, TInt aSuppRange, TInt aTestValue, TInt aExpValue)
1.1723 + {
1.1724 + // Overlay modes //
1.1725 + CCamera::CCameraOverlay* overlay = NULL;
1.1726 + TInt error = KErrNone;
1.1727 + TRAP(error, overlay = CCamera::CCameraOverlay::NewL(aCamera));
1.1728 +
1.1729 + if (overlay == NULL)
1.1730 + {
1.1731 + INFO_PRINTF1(_L("--Error: Failed to get the CCameraOverlay"));
1.1732 + User::Leave(KErrGeneral);
1.1733 + }
1.1734 + CleanupStack::PushL(overlay);
1.1735 + CCamera::CCameraOverlay::TOverlaySupportInfo overlaySupInfo;
1.1736 + overlay->GetOverlaySupport( overlaySupInfo );
1.1737 +
1.1738 + if (overlaySupInfo.iSupportedModes != aSuppRange)
1.1739 + {
1.1740 + INFO_PRINTF2(_L("--Error: Supported overlay modes are wrong %x "), overlaySupInfo.iSupportedModes);
1.1741 + User::Leave(KErrGeneral);
1.1742 + }
1.1743 +
1.1744 + CCamera::CCameraOverlay::TOverlayParameters ovrParams;
1.1745 + ovrParams.iCurrentModes = aTestValue;
1.1746 + ovrParams.iCurrentTypes = CCamera::CCameraOverlay::EPerPixel;
1.1747 +
1.1748 + CFbsBitmap* bmp = new (ELeave) CFbsBitmap();
1.1749 + CleanupStack::PushL(bmp);
1.1750 + TUint handle = 0;
1.1751 + TRAP(error, handle = overlay->CreateOverlayL(ovrParams, bmp) );
1.1752 + if (error != KErrNone)
1.1753 + {
1.1754 + INFO_PRINTF2(_L("--Error: failed to create overlay %d "), error);
1.1755 + User::Leave(KErrGeneral);
1.1756 + }
1.1757 +
1.1758 + CCamera::CCameraOverlay::TOverlayParameters retrievedParams;
1.1759 + overlay->GetOverlayParametersL(handle, retrievedParams);
1.1760 + overlay->ReleaseOverlay(handle);
1.1761 +
1.1762 + if (retrievedParams.iCurrentModes != aExpValue)
1.1763 + {
1.1764 + INFO_PRINTF2(_L("--Error: wrong overlay params retrieved %x "), retrievedParams.iCurrentModes);
1.1765 + User::Leave(KErrGeneral);
1.1766 + }
1.1767 + CleanupStack::PopAndDestroy(2, overlay);
1.1768 + }
1.1769 +
1.1770 +TVerdict RECamAdvSetTest2::DoTestStepL()
1.1771 + {
1.1772 + const TInt KNew2PixRatio = CCamera::CCameraAdvancedSettings::EEPixelAspect40To33;
1.1773 + const TInt KNew2SuppRatios = ( CCamera::CCameraAdvancedSettings::EEPixelAspect40To33 << 1) - 1;
1.1774 +
1.1775 + const TInt KOldPixRatio = CCamera::CCameraAdvancedSettings::EEPixelAspect59To54;
1.1776 + const TInt KOldSuppRatios = ( CCamera::CCameraAdvancedSettings::EEPixelAspect59To54 << 1) - 1;
1.1777 +
1.1778 + const TInt KNew2FlashModes = (CCamera::EFlashVideoLight << 1) - 1;
1.1779 + const TInt KNew2FlashMode = CCamera::EFlashVideoLight;
1.1780 +
1.1781 + const TInt KOldFlashModes = (CCamera::EFlashManual << 1) - 1;
1.1782 + const TInt KOldFlashMode = CCamera::EFlashManual;
1.1783 +
1.1784 + const TInt KNew2OvrSuppt = (CCamera::CCameraOverlay::EModeStillImageBurst << 1) - 1;
1.1785 + const TInt KOldOvrSuppt = (CCamera::CCameraOverlay::EModeVideo << 1) - 1;
1.1786 +
1.1787 + CCamera* camera = NULL;
1.1788 + TInt callbackError = KErrNone;
1.1789 + TDummyObserver observer2(callbackError);
1.1790 +
1.1791 + TInt error = KErrNone;
1.1792 + CCamera::CCameraAdvancedSettings* settings = NULL;
1.1793 +
1.1794 + TRAP(error, camera = CCamera::New2L(observer2, 0, 100));
1.1795 + if (error!=KErrNone)
1.1796 + {
1.1797 + INFO_PRINTF2(_L("--Error creating CCamera object %d"),error);
1.1798 + User::Leave(KErrGeneral);
1.1799 + }
1.1800 + CleanupStack::PushL(camera);
1.1801 +
1.1802 + settings = static_cast<CCamera::CCameraAdvancedSettings*>
1.1803 + (camera->CustomInterface(KECamAdvancedSettingUid));
1.1804 + if (settings == NULL)
1.1805 + {
1.1806 + INFO_PRINTF1(_L("--Error: Failed to get the CCameraAdvancedSettings"));
1.1807 + User::Leave(KErrGeneral);
1.1808 + }
1.1809 + CleanupStack::PushL(settings);
1.1810 +
1.1811 + RatioSubStepL(settings, KNew2SuppRatios, KNew2PixRatio, KNew2PixRatio);
1.1812 + FlashSubStepL(settings, KNew2FlashModes, KNew2FlashMode, KNew2FlashMode);
1.1813 + OvrSubStepL(*camera, KNew2OvrSuppt, KNew2OvrSuppt, KNew2OvrSuppt);
1.1814 +
1.1815 + CleanupStack::PopAndDestroy(2, camera);
1.1816 +
1.1817 +// now try to use it as an "old" client //
1.1818 + TRAP(error, camera = CCamera::NewL(observer2, 0, 100));
1.1819 + if (error!=KErrNone)
1.1820 + {
1.1821 + INFO_PRINTF2(_L("--Error creating CCamera object %d"),error);
1.1822 + User::Leave(KErrGeneral);
1.1823 + }
1.1824 + CleanupStack::PushL(camera);
1.1825 +
1.1826 + settings = static_cast<CCamera::CCameraAdvancedSettings*>
1.1827 + (camera->CustomInterface(KECamAdvancedSettingUid));
1.1828 + if (settings == NULL)
1.1829 + {
1.1830 + INFO_PRINTF1(_L("--Error: Failed to get the CCameraAdvancedSettings"));
1.1831 + User::Leave(KErrGeneral);
1.1832 + }
1.1833 + CleanupStack::PushL(settings);
1.1834 +
1.1835 + RatioSubStepL(settings, KOldSuppRatios, KOldPixRatio, KOldPixRatio);
1.1836 + RatioSubStepL(settings, KOldSuppRatios, KNew2PixRatio, CCamera::CCameraAdvancedSettings::EPixelAspectUnknown);
1.1837 +
1.1838 + FlashSubStepL(settings, KOldFlashModes, KOldFlashMode, KOldFlashMode);
1.1839 + FlashSubStepL(settings, KOldFlashModes, KNew2FlashMode, CCamera::EFlashAuto);
1.1840 +
1.1841 + OvrSubStepL(*camera, KOldOvrSuppt, KOldOvrSuppt, KOldOvrSuppt);
1.1842 + OvrSubStepL(*camera, KOldOvrSuppt, CCamera::CCameraOverlay::EModeClientViewfinder,
1.1843 + CCamera::CCameraOverlay::EModeViewfinder);
1.1844 +
1.1845 + OvrSubStepL(*camera, KOldOvrSuppt, CCamera::CCameraOverlay::EModeStillImageBurst,
1.1846 + CCamera::CCameraOverlay::EModeStillImage);
1.1847 +
1.1848 + CleanupStack::PopAndDestroy(2, camera);
1.1849 + return EPass;
1.1850 + }
1.1851 +
1.1852 +
1.1853 +RECamContinuousZoomAllocTest* RECamContinuousZoomAllocTest::NewL(TBool aAllocTest)
1.1854 + {
1.1855 + RECamContinuousZoomAllocTest* self = new (ELeave) RECamContinuousZoomAllocTest(aAllocTest);
1.1856 + return self;
1.1857 + }
1.1858 +
1.1859 +RECamContinuousZoomAllocTest::RECamContinuousZoomAllocTest(TBool /*aAllocTest*/)
1.1860 + {
1.1861 + iTestStepName = _L("MM-ECM-ADV-U-058-HP");
1.1862 + }
1.1863 +
1.1864 +TVerdict RECamContinuousZoomAllocTest::DoTestStepL()
1.1865 + {
1.1866 + TVerdict verdict = EFail;
1.1867 + INFO_PRINTF1(_L("Alloc test"));
1.1868 + TInt i;
1.1869 + TInt err;
1.1870 + for (i = 1 ; ; i++)
1.1871 + {
1.1872 + __MM_HEAP_MARK;
1.1873 +
1.1874 + if (i % 5 == 0)
1.1875 + {
1.1876 + INFO_PRINTF2(_L("Fail count = %d"), i);
1.1877 + }
1.1878 +
1.1879 + __UHEAP_SETFAIL(RHeap::EFailNext, i);
1.1880 +
1.1881 + TRAP(err, verdict = DoAllocTestStepL());
1.1882 +
1.1883 + TAny* testAlloc = User::Alloc(1);
1.1884 + TBool heapTestingComplete = (testAlloc == NULL) && (err==KErrNone);
1.1885 + User::Free(testAlloc);
1.1886 +
1.1887 + __UHEAP_RESET;
1.1888 + __MM_HEAP_MARKEND;
1.1889 +
1.1890 + if ((err != KErrNoMemory ) || heapTestingComplete)
1.1891 + {
1.1892 + INFO_PRINTF4(_L("err = %d, verdict = %d, Fail count = %d"), err, verdict, i);
1.1893 + INFO_PRINTF1(_L("Alloc testing completed successfully"));
1.1894 + verdict = EPass;
1.1895 + break;
1.1896 + }
1.1897 + }
1.1898 + return verdict;
1.1899 + }
1.1900 +
1.1901 +TVerdict RECamContinuousZoomAllocTest::DoAllocTestStepL()
1.1902 + {
1.1903 + TVerdict result = EPass;
1.1904 + CCamera* camera = NULL;
1.1905 +
1.1906 + TInt error = KErrNone;
1.1907 + CCamera::CCameraAdvancedSettings* settings = NULL;
1.1908 + CCamera::CCameraContinuousZoom* zoom = NULL;
1.1909 +
1.1910 + // using observer 2 if exist
1.1911 + MCameraObserver2* observer2 = NULL;
1.1912 +
1.1913 + __MM_HEAP_MARK;
1.1914 + INFO_PRINTF1(_L("Create camera using Camera::New2L() and MCameraObserver2"));
1.1915 + TRAP(error, camera = CCamera::New2L(*observer2, 0,0));
1.1916 + if (error==KErrNone)
1.1917 + {
1.1918 + CleanupStack::PushL(camera);
1.1919 + INFO_PRINTF1(_L("Create advanced settings from CCamera object"));
1.1920 + settings = static_cast<CCamera::CCameraAdvancedSettings*> (camera->CustomInterface(KECamAdvancedSettingUid));
1.1921 + if (settings!= NULL)
1.1922 + {
1.1923 + CleanupStack::PushL(settings);
1.1924 + INFO_PRINTF1(_L("CCameraAdvancedSettings object was created"));
1.1925 + CCamera::CCameraAdvancedSettings::TContinuousZoomType continuousZoomType =
1.1926 + CCamera::CCameraAdvancedSettings::EContinuousZoomMixed;
1.1927 +
1.1928 + INFO_PRINTF1(_L("Create continuous zoom from advanced settings object"));
1.1929 + TRAP(error, settings->CreateContinuousZoomL(*this, continuousZoomType, zoom));
1.1930 + if (error == KErrNone)
1.1931 + {
1.1932 + CleanupStack::PushL(zoom);
1.1933 + }
1.1934 + else
1.1935 + {
1.1936 + ERR_PRINTF2(_L("Unexpected %d return from CCamera::CreateContinuousZoomL()"), error);
1.1937 + result = EFail;
1.1938 + User::Leave(KErrNoMemory);
1.1939 + }
1.1940 + }
1.1941 + else
1.1942 + {
1.1943 + ERR_PRINTF1(_L("Could not create CCameraAdvancedSettings"));
1.1944 + result = EFail;
1.1945 + User::Leave(KErrNoMemory);
1.1946 + }
1.1947 + }
1.1948 + else
1.1949 + {
1.1950 + ERR_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
1.1951 + result = EFail;
1.1952 + User::Leave(KErrNoMemory);
1.1953 + }
1.1954 +
1.1955 + CleanupStack::PopAndDestroy(3, camera);
1.1956 + __MM_HEAP_MARKEND;
1.1957 +
1.1958 + // create a settings object using New2L
1.1959 + __MM_HEAP_MARK;
1.1960 + INFO_PRINTF1(_L("Create camera using Camera::New2L() and MCameraObserver2"));
1.1961 +
1.1962 + TRAP(error, camera = CCamera::New2L(*observer2, 0,0));
1.1963 +
1.1964 + if (error==KErrNone)
1.1965 + {
1.1966 + CleanupStack::PushL(camera);
1.1967 + TRAP(error, settings = CCamera::CCameraAdvancedSettings::NewL(*camera));
1.1968 + if (error==KErrNone)
1.1969 + {
1.1970 + CleanupStack::PushL(settings);
1.1971 + INFO_PRINTF1(_L("CCameraAdvancedSettings object was created using NewL"));
1.1972 + CCamera::CCameraAdvancedSettings::TContinuousZoomType continuousZoomType =
1.1973 + CCamera::CCameraAdvancedSettings::EContinuousZoomMixed;
1.1974 +
1.1975 + INFO_PRINTF1(_L("Create continuous zoom from advanced settings object"));
1.1976 + TRAP(error, settings->CreateContinuousZoomL(*this, continuousZoomType, zoom));
1.1977 + if (error == KErrNone)
1.1978 + {
1.1979 + CleanupStack::PushL(zoom);
1.1980 + }
1.1981 + else
1.1982 + {
1.1983 + ERR_PRINTF2(_L("Unexpected %d return from CCamera::CreateContinuousZoomL()"), error);
1.1984 + result = EFail;
1.1985 + User::Leave(KErrNoMemory);
1.1986 + }
1.1987 + }
1.1988 + else
1.1989 + {
1.1990 + ERR_PRINTF1(_L("CCameraAdvancedSettings object was not created using NewL"));
1.1991 + result = EFail;
1.1992 + User::Leave(KErrNoMemory);
1.1993 + }
1.1994 + }
1.1995 + else
1.1996 + {
1.1997 + ERR_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
1.1998 + result = EFail;
1.1999 + User::Leave(KErrNoMemory);
1.2000 + }
1.2001 +
1.2002 + CleanupStack::PopAndDestroy(3, camera);
1.2003 + __MM_HEAP_MARKEND;
1.2004 + return result;
1.2005 + }
1.2006 +
1.2007 +RECamContinuousZoomTest* RECamContinuousZoomTest::NewL(TBool aAllocTest)
1.2008 + {
1.2009 + RECamContinuousZoomTest* self = new (ELeave) RECamContinuousZoomTest(aAllocTest);
1.2010 + return self;
1.2011 + }
1.2012 +
1.2013 +RECamContinuousZoomTest::RECamContinuousZoomTest(TBool /*aAllocTest*/)
1.2014 + {
1.2015 + iTestStepName = _L("MM-ECM-ADV-U-060-HP");
1.2016 + }
1.2017 +
1.2018 +TVerdict RECamContinuousZoomTest::DoTestStepL()
1.2019 + {
1.2020 + __MM_HEAP_MARK;
1.2021 + TVerdict result = EPass;
1.2022 + CCamera* camera = NULL;
1.2023 + TInt callbackError = KErrNone;
1.2024 + TDummyObserver observer2(callbackError);
1.2025 +
1.2026 + CCamera::CCameraAdvancedSettings* settings = NULL;
1.2027 +
1.2028 + camera = CCamera::New2L(observer2, 0, 0);
1.2029 + CleanupStack::PushL(camera);
1.2030 +
1.2031 + settings = static_cast<CCamera::CCameraAdvancedSettings*>(camera->CustomInterface(KECamAdvancedSettingUid));
1.2032 + if (settings == NULL)
1.2033 + {
1.2034 + ERR_PRINTF1(_L("--Error: Failed to get the CCameraAdvancedSettings"));
1.2035 + User::Leave(KErrGeneral);
1.2036 + }
1.2037 + CleanupStack::PushL(settings);
1.2038 +
1.2039 + TUint supportedContinuousZoomType = 100;
1.2040 + settings->GetSupportedContinuousZoomTypeL(supportedContinuousZoomType);
1.2041 + if(supportedContinuousZoomType != 0)
1.2042 + {
1.2043 + ERR_PRINTF1(_L("GetSupportedContinuousZoomTypeL supported!"));
1.2044 + result = EFail;
1.2045 + CleanupStack::PopAndDestroy(2, camera);
1.2046 + return result;
1.2047 + }
1.2048 +
1.2049 + CCamera::CCameraAdvancedSettings::TContinuousZoomType continuousZoomType =
1.2050 + CCamera::CCameraAdvancedSettings::EContinuousZoomMixed;
1.2051 +
1.2052 + CCamera::CCameraContinuousZoom* continuousZoom = NULL;
1.2053 + settings->CreateContinuousZoomL(*this, continuousZoomType, continuousZoom);
1.2054 + CleanupStack::PushL(continuousZoom);
1.2055 +
1.2056 + CCamera::CCameraAdvancedSettings::TContinuousZoomSupportInfo info;
1.2057 + continuousZoom->GetContinuousZoomSupportInfoL(info);
1.2058 +
1.2059 + INFO_PRINTF1(_L("Fake supported continuous zoom settings are:"));
1.2060 + INFO_PRINTF2(_L("Max speed supported = %d"), info.iMaxSpeedSupported);
1.2061 + INFO_PRINTF2(_L("Min acceleration supported = %d"), info.iMinAccelerationSupported);
1.2062 + INFO_PRINTF2(_L("Max acceleration supported = %d"), info.iMaxAccelerationSupported);
1.2063 + INFO_PRINTF2(_L("Min continuous zoom limit = %d"), info.iContinuousZoomMinLimit);
1.2064 + INFO_PRINTF2(_L("Max continuous zoom limit = %d"), info.iContinuousZoomMaxLimit);
1.2065 +
1.2066 + CCamera::CCameraAdvancedSettings::TContinuousZoomParameters param;
1.2067 + param.iContinuousZoomType = continuousZoomType;
1.2068 + param.iContinuousZoomAcceleration = 0;
1.2069 + param.iContinuousZoomSpeed = 1;
1.2070 + param.iContinuousZoomLimit = 5;
1.2071 + param.iZoomDirection = CCamera::CCameraAdvancedSettings::EZoomDirectionWide;
1.2072 +
1.2073 + INFO_PRINTF1(_L("Calling StartContinuousZoomL()"));
1.2074 + continuousZoom->StartContinuousZoomL(param);
1.2075 +
1.2076 + INFO_PRINTF1(_L("Calling StopContinuousZoomL()"));
1.2077 + continuousZoom->StopContinuousZoom();
1.2078 +
1.2079 + INFO_PRINTF1(_L("Creating second continuous zoom object and comparing unique zoom ids"));
1.2080 + TInt id = 0;
1.2081 + TInt secondId = 0;
1.2082 + continuousZoom->GetContinuousZoomId(id);
1.2083 +
1.2084 + CCamera::CCameraContinuousZoom* secondContinuousZoom = NULL;
1.2085 + settings->CreateContinuousZoomL(*this, continuousZoomType, secondContinuousZoom);
1.2086 + secondContinuousZoom->GetContinuousZoomId(secondId);
1.2087 +
1.2088 + INFO_PRINTF2(_L("Zoom Id of first object is %d"), id);
1.2089 + INFO_PRINTF2(_L("Zoom Id of second object is %d"), secondId);
1.2090 + if(id == secondId)
1.2091 + {
1.2092 + ERR_PRINTF1(_L("Zoom ids of both continuous zoom objects are the same"));
1.2093 + result = EFail;
1.2094 + delete secondContinuousZoom;
1.2095 + CleanupStack::PopAndDestroy(3, camera);
1.2096 + return result;
1.2097 + }
1.2098 + delete secondContinuousZoom;
1.2099 +
1.2100 + INFO_PRINTF1(_L("Attempting to start continuous zoom with 'unsupported' values"));
1.2101 + param.iContinuousZoomSpeed = 100;
1.2102 + param.iContinuousZoomAcceleration = -10;
1.2103 + param.iContinuousZoomLimit = 20;
1.2104 + TRAPD(err, continuousZoom->StartContinuousZoomL(param));
1.2105 + if(err == KErrArgument)
1.2106 + {
1.2107 + INFO_PRINTF2(_L("StartContinuousZoom() correctly failed with %d"), err);
1.2108 + }
1.2109 + else if(err == KErrNone)
1.2110 + {
1.2111 + ERR_PRINTF1(_L("StartContinuousZoom() succeeded with unsupported values"));
1.2112 + result = EFail;
1.2113 + }
1.2114 + else
1.2115 + {
1.2116 + ERR_PRINTF2(_L("StartContinuousZoom() failed with unexpected error %d"), err);
1.2117 + result = EFail;
1.2118 + }
1.2119 +
1.2120 + CleanupStack::PopAndDestroy(3, camera);
1.2121 + __MM_HEAP_MARKEND;
1.2122 + return result;
1.2123 + }
1.2124 +
1.2125 +
1.2126 +RECamDependantSupportedDriveModesTest* RECamDependantSupportedDriveModesTest::NewL(TBool aAllocTest)
1.2127 + {
1.2128 + RECamDependantSupportedDriveModesTest* self = new (ELeave) RECamDependantSupportedDriveModesTest(aAllocTest);
1.2129 + return self;
1.2130 + }
1.2131 +
1.2132 +RECamDependantSupportedDriveModesTest::RECamDependantSupportedDriveModesTest(TBool /*aAllocTest*/)
1.2133 + {
1.2134 + iTestStepName = _L("MM-ECM-ADV-U-061-HP");
1.2135 + }
1.2136 +
1.2137 +TVerdict RECamDependantSupportedDriveModesTest::DoTestStepL()
1.2138 + {
1.2139 + __MM_HEAP_MARK;
1.2140 + TVerdict result = EPass;
1.2141 + CCamera* camera = NULL;
1.2142 + MCameraObserver* observer = NULL;
1.2143 + MCameraObserver2* observer2 = NULL;
1.2144 + CCamera::CCameraAdvancedSettings* settings = NULL;
1.2145 +
1.2146 + INFO_PRINTF1(_L("Testing drive modes returned for legacy CCamera::NewL()"));
1.2147 + camera = CCamera::NewL(*observer, 0);
1.2148 + CleanupStack::PushL(camera);
1.2149 +
1.2150 + settings = static_cast<CCamera::CCameraAdvancedSettings*>(camera->CustomInterface(KECamAdvancedSettingUid));
1.2151 + if (settings == NULL)
1.2152 + {
1.2153 + ERR_PRINTF1(_L("--Error: Failed to get the CCameraAdvancedSettings"));
1.2154 + User::Leave(KErrGeneral);
1.2155 + }
1.2156 + CleanupStack::PushL(settings);
1.2157 +
1.2158 + CCamera::CCameraAdvancedSettings::TDriveMode driveMode = settings->DriveMode();
1.2159 + if(driveMode != CCamera::CCameraAdvancedSettings::EDriveModeAuto)
1.2160 + {
1.2161 + ERR_PRINTF1(_L("Drive mode returned for CCamera::NewL() not CCameraAdvancedSettings::EDriveModeAuto as expected"));
1.2162 + result = EFail;
1.2163 + return result;
1.2164 + }
1.2165 +
1.2166 + TInt supportedDriveModes = settings->SupportedDriveModes();
1.2167 + if(supportedDriveModes & CCamera::CCameraAdvancedSettings::EDriveModeTimeNudgeCapture)
1.2168 + {
1.2169 + ERR_PRINTF1(_L("Unexpected error - EDriveModeTimeNudgeCapture supported for CCamera::NewL()"));
1.2170 + result = EFail;
1.2171 + return result;
1.2172 + }
1.2173 +
1.2174 + settings->SetDriveMode(CCamera::CCameraAdvancedSettings::EDriveModeTimeNudgeCapture);
1.2175 + driveMode = settings->DriveMode();
1.2176 + if(driveMode == CCamera::CCameraAdvancedSettings::EDriveModeTimeNudgeCapture)
1.2177 + {
1.2178 + ERR_PRINTF1(_L("Unexpected error - drive mode is EDriveModeTimeNudgeCapture for CCamera::NewL()"));
1.2179 + result = EFail;
1.2180 + return result;
1.2181 + }
1.2182 + else
1.2183 + {
1.2184 + INFO_PRINTF1(_L("Supported drive modes do not include new EDriveTimeNudgeCapture - expected for CCamera::NewL()"));
1.2185 + }
1.2186 + CleanupStack::PopAndDestroy(2, camera);
1.2187 +
1.2188 +
1.2189 +
1.2190 + INFO_PRINTF1(_L("Now testing drive modes returned for CCamera::New2L()"));
1.2191 + camera = CCamera::New2L(*observer2, 0, 0);
1.2192 + CleanupStack::PushL(camera);
1.2193 +
1.2194 + settings = static_cast<CCamera::CCameraAdvancedSettings*>(camera->CustomInterface(KECamAdvancedSettingUid));
1.2195 + if (settings == NULL)
1.2196 + {
1.2197 + ERR_PRINTF1(_L("--Error: Failed to get the CCameraAdvancedSettings"));
1.2198 + User::Leave(KErrGeneral);
1.2199 + }
1.2200 + CleanupStack::PushL(settings);
1.2201 +
1.2202 + supportedDriveModes = settings->SupportedDriveModes();
1.2203 + settings->SetDriveMode(CCamera::CCameraAdvancedSettings::EDriveModeTimeNudgeCapture);
1.2204 + driveMode = settings->DriveMode();
1.2205 + CleanupStack::PopAndDestroy(2, camera);
1.2206 +
1.2207 + if(!(supportedDriveModes & CCamera::CCameraAdvancedSettings::EDriveModeTimeNudgeCapture))
1.2208 + {
1.2209 + ERR_PRINTF1(_L("Unexpected error - EDriveModeTimeNudgeCapture not supported for CCamera::New2L()"));
1.2210 + result = EFail;
1.2211 + return result;
1.2212 + }
1.2213 + else if(driveMode != CCamera::CCameraAdvancedSettings::EDriveModeTimeNudgeCapture)
1.2214 + {
1.2215 + ERR_PRINTF1(_L("Unexpected error - drive mode is not EDriveModeTimeNudgeCapture for CCamera::New2L()"));
1.2216 + result = EFail;
1.2217 + return result;
1.2218 + }
1.2219 + else
1.2220 + {
1.2221 + INFO_PRINTF1(_L("Supported drive modes include new EDriveTimeNudgeCapture - expected for CCamera::New2L()"));
1.2222 + }
1.2223 +
1.2224 + __MM_HEAP_MARKEND;
1.2225 + return result;
1.2226 + }