os/mm/imagingandcamerafws/cameraunittest/src/TSU_ECM_ADV/ecamextendedfunctest.cpp
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/imagingandcamerafws/cameraunittest/src/TSU_ECM_ADV/ecamextendedfunctest.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,2873 @@
1.4 +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#include <ecamuids.hrh>
1.20 +#include <w32std.h>
1.21 +#include <ecom/ecomresolverparams.h>
1.22 +#include "ecamextendedfunctest.h"
1.23 +#include "ECamUnitTestPluginUids.hrh"
1.24 +#include "ECamUnitTestPlugin.h"
1.25 +#include <ecam/ecamcommonuids.hrh>
1.26 +#include <fbs.h>
1.27 +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
1.28 +#include <ecamconst.h>
1.29 +#include "ecamdef.h"
1.30 +#include <ecamcapturecontrolconst.h>
1.31 +#endif
1.32 +/*------------------------------------------------------
1.33 + Client ViewFinder : RECamClientViewFinderTest
1.34 + *------------------------------------------------------*/
1.35 +RECamClientViewFinderTest* RECamClientViewFinderTest::NewL(const TDesC& aTestStep)
1.36 + {
1.37 + RECamClientViewFinderTest* self = new (ELeave) RECamClientViewFinderTest(aTestStep);
1.38 + return self;
1.39 + }
1.40 +
1.41 +RECamClientViewFinderTest::RECamClientViewFinderTest(const TDesC& aTestStep)
1.42 + {
1.43 + iTestStepName.Copy(aTestStep);
1.44 + }
1.45 +
1.46 +TVerdict RECamClientViewFinderTest::DoTestStepL()
1.47 + {
1.48 + if(!iTestStepName.Compare(_L("MM-ECM-ADV-U-050-HP")))
1.49 + {
1.50 + return DoTestStep_50L();
1.51 + }
1.52 + return EInconclusive;
1.53 + }
1.54 +
1.55 +TVerdict RECamClientViewFinderTest::DoTestStep_50L()
1.56 + {
1.57 + TVerdict verdict = EFail;
1.58 + INFO_PRINTF1(_L("Alloc test"));
1.59 + TInt i;
1.60 + TInt err;
1.61 + for (i = 1 ; ; i++)
1.62 + {
1.63 + __MM_HEAP_MARK;
1.64 +
1.65 + if (i % 5 == 0)
1.66 + {
1.67 + INFO_PRINTF2(_L("Fail count = %d"), i);
1.68 + }
1.69 +
1.70 + __UHEAP_SETFAIL(RHeap::EFailNext, i);
1.71 +
1.72 + TRAP(err, verdict = DoClientVFTestStepL());
1.73 +
1.74 + TAny* testAlloc = User::Alloc(1);
1.75 + TBool heapTestingComplete = (testAlloc == NULL) && (err==KErrNone);
1.76 + User::Free(testAlloc);
1.77 +
1.78 + __UHEAP_RESET;
1.79 + __MM_HEAP_MARKEND;
1.80 +
1.81 + if ((err != KErrNoMemory ) || heapTestingComplete)
1.82 + {
1.83 + INFO_PRINTF4(_L("err = %d, verdict = %d, Fail count = %d"), err, verdict, i);
1.84 + INFO_PRINTF1(_L("Alloc testing completed successfully"));
1.85 + verdict = EPass;
1.86 + break;
1.87 + }
1.88 + }
1.89 + return verdict;
1.90 + }
1.91 +
1.92 +TVerdict RECamClientViewFinderTest::DoClientVFTestStepL()
1.93 + {
1.94 + TVerdict result = EPass;
1.95 + CCamera* camera = NULL;
1.96 +
1.97 + MClientViewFinderObserver *clientVFObserver = NULL;
1.98 + TInt error = KErrNone;
1.99 + CCamera::CCameraClientViewFinder* clientVF = NULL;
1.100 +
1.101 + MCameraObserver* observer = NULL;
1.102 +
1.103 + // using observer
1.104 + __MM_HEAP_MARK;
1.105 + INFO_PRINTF1(_L("Create camera using Camera::NewL() and MCameraObserver"));
1.106 + TRAP(error, camera = CCamera::NewL(*observer, 0));
1.107 + if (error==KErrNone)
1.108 + {
1.109 + CleanupStack::PushL(camera);
1.110 + INFO_PRINTF1(_L("Create client viewfinder from CCamera object"));
1.111 +
1.112 + TRAP(error, clientVF = CCamera::CCameraClientViewFinder::NewL(*camera, *clientVFObserver));
1.113 + if (error==KErrExtensionNotSupported)
1.114 + {
1.115 + INFO_PRINTF1(_L("CCameraClientViewFinder object creation using old Observer failed with correct error"));
1.116 + }
1.117 + else
1.118 + {
1.119 + INFO_PRINTF1(_L("CCameraClientViewFinder object creation using old Observer gave unexpected result"));
1.120 + result = EFail;
1.121 + }
1.122 + CleanupStack::PopAndDestroy(camera);
1.123 + }
1.124 + else
1.125 + {
1.126 + INFO_PRINTF2(_L("Unexpected %d return from CCamera::NewL()"), error);
1.127 + result = EFail;
1.128 + User::Leave(KErrNoMemory);
1.129 + }
1.130 + __MM_HEAP_MARKEND;
1.131 +
1.132 + // using observer2 with NewL
1.133 + MCameraObserver2* observer2 = NULL;
1.134 + __MM_HEAP_MARK;
1.135 + INFO_PRINTF1(_L("Create camera using Camera::NewL() and MCameraObserver2"));
1.136 + TRAP(error, camera = CCamera::NewL(*observer2, 0,0));
1.137 + if (error==KErrNone)
1.138 + {
1.139 + CleanupStack::PushL(camera);
1.140 + INFO_PRINTF1(_L("Create client viewfinder from CCamera object"));
1.141 +
1.142 + TRAP(error, clientVF = CCamera::CCameraClientViewFinder::NewL(*camera, *clientVFObserver));
1.143 + if (error==KErrExtensionNotSupported)
1.144 + {
1.145 + INFO_PRINTF1(_L("CCameraClientViewFinder object creation using Observer2 with NewL failed with correct error"));
1.146 + }
1.147 + else
1.148 + {
1.149 + INFO_PRINTF1(_L("CCameraClientViewFinder object creation using Observer2 with NewL gave unexpected result"));
1.150 + result = EFail;
1.151 + }
1.152 + CleanupStack::PopAndDestroy(camera);
1.153 + }
1.154 + else
1.155 + {
1.156 + INFO_PRINTF2(_L("Unexpected %d return from CCamera::NewL()"), error);
1.157 + result = EFail;
1.158 + User::Leave(KErrNoMemory);
1.159 + }
1.160 + __MM_HEAP_MARKEND;
1.161 +
1.162 + // create client viewfinder object using New2L
1.163 + __MM_HEAP_MARK;
1.164 +
1.165 + INFO_PRINTF1(_L("Create camera using Camera::New2L() and MCameraObserver2"));
1.166 +
1.167 + TRAP(error, camera = CCamera::New2L(*observer2, 0,0));
1.168 + if (error==KErrNone)
1.169 + {
1.170 + CleanupStack::PushL(camera);
1.171 + INFO_PRINTF1(_L("KErrNone return from CCamera::New2L()"));
1.172 + TRAP(error, clientVF = CCamera::CCameraClientViewFinder::NewL(*camera, *clientVFObserver));
1.173 +
1.174 + if (error==KErrNone)
1.175 + {
1.176 + CleanupStack::PushL(clientVF);
1.177 + INFO_PRINTF1(_L("CCameraClientViewFinder object was created using NewL"));
1.178 +
1.179 + INFO_PRINTF1(_L("Create Histogram for Client ViewFinder"));
1.180 + CCamera::CCameraV2Histogram* histogram_CVF = clientVF->CreateHistogramHandleL();
1.181 + if(!histogram_CVF)
1.182 + {
1.183 + INFO_PRINTF1(_L("Histogram creation for Client ViewFinder unsuccessful"));
1.184 + result = EFail;
1.185 + User::Leave(KErrNoMemory);
1.186 + }
1.187 +
1.188 + CleanupStack::PushL(histogram_CVF);
1.189 + INFO_PRINTF1(_L("Histogram object was created for Client ViewFinder"));
1.190 + CleanupStack::PopAndDestroy(histogram_CVF);
1.191 +
1.192 + CleanupStack::PopAndDestroy(clientVF);
1.193 + }
1.194 + else
1.195 + {
1.196 + INFO_PRINTF1(_L("CCameraClientViewFinder object was not created using NewL"));
1.197 + result = EFail;
1.198 + User::Leave(KErrNoMemory);
1.199 + }
1.200 + CleanupStack::PopAndDestroy(camera);
1.201 + }
1.202 + else
1.203 + {
1.204 + INFO_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
1.205 + result = EFail;
1.206 + User::Leave(KErrNoMemory);
1.207 + }
1.208 + __MM_HEAP_MARKEND;
1.209 +
1.210 + return result;
1.211 + }
1.212 +
1.213 +/*------------------------------------------------------
1.214 + Client ViewFinder : RECamClientVFNotificationTest
1.215 + *------------------------------------------------------*/
1.216 +RECamClientVFNotificationTest* RECamClientVFNotificationTest::NewL(TBool aAllocTest)
1.217 + {
1.218 + RECamClientVFNotificationTest* self = new (ELeave) RECamClientVFNotificationTest(aAllocTest);
1.219 + CleanupStack::PushL(self);
1.220 + self->ConstructL();
1.221 + CleanupStack::Pop(self);
1.222 + return self;
1.223 + }
1.224 +
1.225 +void RECamClientVFNotificationTest::ConstructL()
1.226 + {
1.227 + }
1.228 +
1.229 +RECamClientVFNotificationTest::RECamClientVFNotificationTest(TBool /*aAllocTest*/)
1.230 + {
1.231 + iTestStepName = _L("MM-ECM-ADV-U-051-HP");
1.232 + }
1.233 +
1.234 +void RECamClientVFNotificationTest::ViewFinderBufferReady(CCamera::CCameraClientViewFinder& aClientViewFinderHandle, TInt aErrorCode)
1.235 + {
1.236 + aClientViewFinderHandle.GetViewFinderHandleL(iVFHandle);
1.237 + iError = aErrorCode;
1.238 + }
1.239 +
1.240 +void RECamClientVFNotificationTest::DirectHistogramDisplayed(CCamera::CCameraClientViewFinder& aClientViewFinderHandle, CCamera::CCameraV2Histogram& /*aDirectHistogramDisplayed*/, TInt aErrorCode)
1.241 + {
1.242 + aClientViewFinderHandle.GetViewFinderHandleL(iVFHandle);
1.243 + iError = aErrorCode;
1.244 + }
1.245 +
1.246 +void RECamClientVFNotificationTest::ClientHistogramReady(CCamera::CCameraClientViewFinder& aClientViewFinderHandle, MHistogramV2Buffer* /*aClientHistogramBuffer*/, TInt aErrorCode)
1.247 + {
1.248 + aClientViewFinderHandle.GetViewFinderHandleL(iVFHandle);
1.249 + iError = aErrorCode;
1.250 + }
1.251 +
1.252 +void RECamClientVFNotificationTest::ImageProcessingFailed(CCamera::CCameraClientViewFinder& aClientViewFinderHandle, TInt aErrorCode)
1.253 + {
1.254 + aClientViewFinderHandle.GetViewFinderHandleL(iVFHandle);
1.255 + iError = aErrorCode;
1.256 + }
1.257 +
1.258 +TInt RECamClientVFNotificationTest::CustomInterface(TUid /*aInterface*/, TAny*& /*aPtrInterface*/)
1.259 + {
1.260 + return KErrNone;
1.261 + }
1.262 +
1.263 +void RECamClientVFNotificationTest::CheckViewFinderNegNotification(TInt aVFHandle, TVerdict& aResult)
1.264 + {
1.265 + INFO_PRINTF4(_L("Expected ClientViewFinder Id %d, received event %x. Error %d."), aVFHandle, iVFHandle, iError);
1.266 + if (aVFHandle != iVFHandle || iError != KErrNotSupported)
1.267 + {
1.268 + aResult = EFail;
1.269 + }
1.270 + }
1.271 +
1.272 +TVerdict RECamClientVFNotificationTest::DoTestStepL()
1.273 + {
1.274 + TVerdict verdict = EFail;
1.275 + INFO_PRINTF1(_L("Alloc test"));
1.276 + TInt i;
1.277 + TInt err;
1.278 + for (i = 1 ; ; i++)
1.279 + {
1.280 + __MM_HEAP_MARK;
1.281 +
1.282 + if (i % 5 == 0)
1.283 + {
1.284 + INFO_PRINTF2(_L("Fail count = %d"), i);
1.285 + }
1.286 +
1.287 + __UHEAP_SETFAIL(RHeap::EFailNext, i);
1.288 +
1.289 + TRAP(err, verdict = DoTestStepL_51L());
1.290 +
1.291 + TAny* testAlloc = User::Alloc(1);
1.292 + TBool heapTestingComplete = (testAlloc == NULL) && (err==KErrNone);
1.293 + User::Free(testAlloc);
1.294 +
1.295 + __UHEAP_RESET;
1.296 + __MM_HEAP_MARKEND;
1.297 +
1.298 + if ((err != KErrNoMemory && verdict == EPass ) || heapTestingComplete)
1.299 + {
1.300 + INFO_PRINTF4(_L("err = %d, verdict = %d, Fail count = %d"), err, verdict, i);
1.301 + INFO_PRINTF1(_L("Alloc testing completed successfully"));
1.302 + verdict = EPass;
1.303 + break;
1.304 + }
1.305 + }
1.306 + return verdict;
1.307 + }
1.308 +
1.309 +TVerdict RECamClientVFNotificationTest::DoTestStepL_51L()
1.310 + {
1.311 + TVerdict result = EPass;
1.312 + CCamera* camera = NULL;
1.313 +
1.314 + TInt error = KErrNone;
1.315 + CCamera::CCameraClientViewFinder* clientVF = NULL;
1.316 +
1.317 +/**************************************************************/
1.318 + MCameraObserver2* observer2 = NULL;
1.319 + __MM_HEAP_MARK;
1.320 + INFO_PRINTF1(_L("Create camera using Camera::NewL() and MCameraObserver2"));
1.321 + TRAP(error, camera = CCamera::NewL(*observer2, 0,0));
1.322 + if (error==KErrNone)
1.323 + {
1.324 + CleanupStack::PushL(camera);
1.325 + INFO_PRINTF1(_L("Create client viewfinder from CCamera object"));
1.326 +
1.327 + TRAP(error, clientVF = CCamera::CCameraClientViewFinder::NewL(*camera, *this));
1.328 +
1.329 + if (error == KErrNone)
1.330 + {
1.331 + INFO_PRINTF1(_L("CCameraClientViewFinder object creation using Observer2 with NewL is successful."));
1.332 + }
1.333 + else if (error==KErrExtensionNotSupported)
1.334 + {
1.335 + INFO_PRINTF1(_L("CCameraClientViewFinder object creation using Observer2 with NewL failed with correct error"));
1.336 + }
1.337 + else
1.338 + {
1.339 + INFO_PRINTF1(_L("CCameraClientViewFinder object creation using Observer2 with NewL gave unexpected result"));
1.340 + result = EFail;
1.341 + }
1.342 + CleanupStack::PopAndDestroy(camera);
1.343 + }
1.344 + else
1.345 + {
1.346 + INFO_PRINTF2(_L("Unexpected %d return from CCamera::NewL()"), error);
1.347 + result = EFail;
1.348 + User::Leave(KErrNoMemory);
1.349 + }
1.350 + __MM_HEAP_MARKEND;
1.351 +/**************************************************************/
1.352 +
1.353 + // create client viewfinder object using New2L
1.354 + __MM_HEAP_MARK;
1.355 + INFO_PRINTF1(_L("Create camera using Camera::New2L() and MCameraObserver2"));
1.356 +
1.357 + TRAP(error, camera = CCamera::New2L(*this, 0, 0));
1.358 +
1.359 + if (error==KErrNone)
1.360 + {
1.361 + CleanupStack::PushL(camera);
1.362 + INFO_PRINTF1(_L("KErrNone return from CCamera::New2L()"));
1.363 + TRAP(error, clientVF = CCamera::CCameraClientViewFinder::NewL(*camera, *this));
1.364 +
1.365 + if (error==KErrNone)
1.366 + {
1.367 + CleanupStack::PushL(clientVF);
1.368 + INFO_PRINTF1(_L("CCameraClientViewFinder object was created using NewL"));
1.369 + //Test Client ViewFinder APIs
1.370 + INFO_PRINTF1(_L("Create Histogram for Client ViewFinder"));
1.371 + CCamera::CCameraV2Histogram* histogram_CVF = clientVF->CreateHistogramHandleL();
1.372 + if(!histogram_CVF)
1.373 + {
1.374 + INFO_PRINTF1(_L("Histogram creation for Client ViewFinder unsuccessful"));
1.375 + result = EFail;
1.376 + }
1.377 +
1.378 + CleanupStack::PushL(histogram_CVF);
1.379 +
1.380 + INFO_PRINTF1(_L("Create ImageProcessing for Client ViewFinder"));
1.381 +
1.382 + TRAPD(err, clientVF->GetTransformationHandleL());
1.383 + if(err != KErrNotSupported)
1.384 + {
1.385 + INFO_PRINTF1(_L("ImageProcessing creation for Client ViewFinder: unexpected result!"));
1.386 + result = EFail;
1.387 + }
1.388 +
1.389 + //set properties for client VF (base class)
1.390 + INFO_PRINTF1(_L("GetViewFinderFadingCapabilitiesL for Client ViewFinder"));
1.391 + CCameraViewFinder::TViewFinderFadingCapabilities fadingCapabilities;
1.392 + TRAP(err,clientVF->GetViewFinderFadingCapabilitiesL(fadingCapabilities));
1.393 + if(err != KErrNotSupported)
1.394 + {
1.395 + INFO_PRINTF1(_L("GetViewFinderFadingCapabilitiesL for Client ViewFinder: unexpected result!"));
1.396 + result = EFail;
1.397 + }
1.398 +
1.399 + INFO_PRINTF1(_L("GetViewFinderFadingEffectL for Client ViewFinder"));
1.400 + CCameraViewFinder::TViewFinderFadingEffect fadingEffect;
1.401 + TRAP(err,clientVF->GetViewFinderFadingEffectL(fadingEffect));
1.402 + if(err != KErrNotSupported)
1.403 + {
1.404 + INFO_PRINTF1(_L("GetViewFinderFadingEffectL for Client ViewFinder: unexpected result!"));
1.405 + result = EFail;
1.406 + }
1.407 +
1.408 + INFO_PRINTF1(_L("SetViewFinderFadingEffectL for Client ViewFinder"));
1.409 + iInputEventUid = KUidECamEvent2ViewFinderFadingEffect;
1.410 + clientVF->SetViewFinderFadingEffectL(fadingEffect);
1.411 + CheckNotificationNeg(iInputEventUid, result);
1.412 +
1.413 + TInt vfHandle=-1;
1.414 + clientVF->GetViewFinderHandleL(vfHandle);
1.415 +
1.416 + //set properties for histogram (for viewfinder)
1.417 + TUint supportedHistogramType=0;
1.418 + histogram_CVF->GetSupportedHistogramsL(supportedHistogramType);
1.419 + if(supportedHistogramType!=0)
1.420 + {
1.421 + INFO_PRINTF1(_L("unexpected GetSupportedHistogramsL"));
1.422 + result = EFail;
1.423 + }
1.424 +
1.425 + INFO_PRINTF1(_L("GetDirectHistogramSupportInfoL for Histogram for Client ViewFinder"));
1.426 + TBool directHistogramSupported = EFalse;
1.427 + TRAP(err,histogram_CVF->GetDirectHistogramSupportInfoL(directHistogramSupported));
1.428 + if(err != KErrNotSupported)
1.429 + {
1.430 + INFO_PRINTF1(_L("GetDirectHistogramSupportInfoL for Histogram for Client ViewFinder: unexpected result!"));
1.431 + result = EFail;
1.432 + }
1.433 +
1.434 + INFO_PRINTF1(_L("PrepareClientHistogramL for Histogram for Client ViewFinder"));
1.435 + CCamera::CCameraV2Histogram::THistogramType histogramType = CCamera::CCameraV2Histogram::EHistNone;
1.436 + TRAP(err,histogram_CVF->PrepareClientHistogramL(histogramType));
1.437 + if(err != KErrNotSupported)
1.438 + {
1.439 + INFO_PRINTF1(_L("PrepareClientHistogramL for Histogram for Client ViewFinder: unexpected result!"));
1.440 + result = EFail;
1.441 + }
1.442 +
1.443 + INFO_PRINTF1(_L("PrepareDirectHistogramL for Histogram for Client ViewFinder"));
1.444 + CCamera::CCameraV2Histogram::TDirectHistogramParameters histogramParameters;
1.445 + TRAP(err,histogram_CVF->PrepareDirectHistogramL(histogramParameters));
1.446 + if(err != KErrNotSupported)
1.447 + {
1.448 + INFO_PRINTF1(_L("PrepareDirectHistogramL for Histogram for Client ViewFinder: unexpected result!"));
1.449 + result = EFail;
1.450 + }
1.451 +
1.452 + INFO_PRINTF1(_L("UpdateDirectHistogramPropertiesL for Histogram for Client ViewFinder"));
1.453 + TRAP(err,histogram_CVF->UpdateDirectHistogramPropertiesL(histogramParameters));
1.454 + if(err != KErrNotSupported)
1.455 + {
1.456 + INFO_PRINTF1(_L("UpdateDirectHistogramPropertiesL for Histogram for Client ViewFinder: unexpected result!"));
1.457 + result = EFail;
1.458 + }
1.459 +
1.460 + INFO_PRINTF1(_L("GetDirectHistogramPropertiesL for Histogram for Client ViewFinder"));
1.461 + TRAP(err,histogram_CVF->GetDirectHistogramPropertiesL(histogramParameters));
1.462 + if(err != KErrNotSupported)
1.463 + {
1.464 + INFO_PRINTF1(_L("GetDirectHistogramPropertiesL for Histogram for Client ViewFinder: unexpected result!"));
1.465 + result = EFail;
1.466 + }
1.467 +
1.468 + INFO_PRINTF1(_L("GetHistogramStateL for Histogram for Client ViewFinder"));
1.469 + TBool histogramActive = EFalse;
1.470 + TRAP(err,histogram_CVF->GetHistogramStateL(histogramActive));
1.471 + if(err != KErrNotSupported)
1.472 + {
1.473 + INFO_PRINTF1(_L("GetHistogramStateL for Histogram for Client ViewFinder: unexpected result!"));
1.474 + result = EFail;
1.475 + }
1.476 +
1.477 + //viewfinder starting...
1.478 + INFO_PRINTF1(_L("StartClientViewFinderL for Client ViewFinder"));
1.479 + TSize size(320,240);
1.480 + TRAP(err,clientVF->StartClientViewFinderL(0, CCamera::EFormatFbsBitmapColor64K, size));
1.481 + if(err != KErrNone)
1.482 + {
1.483 + INFO_PRINTF1(_L("StartClientViewFinderL for Client ViewFinder: unexpected result!"));
1.484 + result = EFail;
1.485 + }
1.486 + CheckViewFinderNegNotification(vfHandle, result);
1.487 +
1.488 + INFO_PRINTF1(_L("GetViewFinderBufferL for Client ViewFinder"));
1.489 + CFbsBitmap* bitmap = new(ELeave) CFbsBitmap;
1.490 + CleanupStack::PushL(bitmap);
1.491 + RCamBuffer2 cameraVFBuffer(bitmap);
1.492 + TRAP(err,clientVF->GetViewFinderBufferL(cameraVFBuffer));
1.493 + if(err != KErrNotSupported)
1.494 + {
1.495 + INFO_PRINTF1(_L("GetViewFinderBufferL for Client ViewFinder: unexpected result!"));
1.496 + result = EFail;
1.497 + }
1.498 + CleanupStack::PopAndDestroy(bitmap);
1.499 +
1.500 + TRect clipRect(TPoint(0,0),size);
1.501 + TRAP(err,clientVF->StartClientViewFinderL(0, CCamera::EFormatFbsBitmapColor64K, size, clipRect));
1.502 + if(err != KErrNone)
1.503 + {
1.504 + INFO_PRINTF1(_L("StartClientViewFinderL for Client ViewFinder: unexpected result!"));
1.505 + result = EFail;
1.506 + }
1.507 + CheckViewFinderNegNotification(vfHandle, result);
1.508 +
1.509 + INFO_PRINTF1(_L("GetClientViewFinderStateL for Client ViewFinder"));
1.510 + TBool activeVF = EFalse;;
1.511 + TRAP(err,clientVF->GetClientViewFinderStateL(activeVF));
1.512 + if(err != KErrNotSupported)
1.513 + {
1.514 + INFO_PRINTF1(_L("GetClientViewFinderStateL for Client ViewFinder: unexpected result!"));
1.515 + result = EFail;
1.516 + }
1.517 +
1.518 + INFO_PRINTF1(_L("StartHistogram for Client ViewFinder"));
1.519 + histogram_CVF->StartHistogram();
1.520 + CheckViewFinderNegNotification(vfHandle, result);
1.521 +
1.522 + INFO_PRINTF1(_L("StopHistogram for Client ViewFinder"));
1.523 + histogram_CVF->StopHistogram();
1.524 +
1.525 + INFO_PRINTF1(_L("GetClientViewFinderPropertiesL for Client ViewFinder"));
1.526 + TInt screenNumber=0;
1.527 + CCamera::TFormat imageFormat=CCamera::EFormatFbsBitmapColor64K;
1.528 + TRAP(err,clientVF->GetClientViewFinderPropertiesL(screenNumber, imageFormat, size, clipRect));
1.529 + if(err != KErrNotSupported)
1.530 + {
1.531 + INFO_PRINTF1(_L("GetClientViewFinderPropertiesL for Client ViewFinder: unexpected result!"));
1.532 + result = EFail;
1.533 + }
1.534 +
1.535 + INFO_PRINTF1(_L("StopClientViewFinder for Client ViewFinder"));
1.536 + clientVF->StopClientViewFinder();
1.537 +
1.538 + CleanupStack::PopAndDestroy(histogram_CVF);
1.539 + CleanupStack::PopAndDestroy(clientVF);
1.540 + }
1.541 + else
1.542 + {
1.543 + INFO_PRINTF1(_L("CCameraClientViewFinder object not created"));
1.544 + result = EFail;
1.545 + }
1.546 + CleanupStack::PopAndDestroy(camera);
1.547 + }
1.548 + else
1.549 + {
1.550 + INFO_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
1.551 + result = EFail;
1.552 + }
1.553 + __MM_HEAP_MARKEND;
1.554 +
1.555 + return result;
1.556 + }
1.557 +
1.558 +/*------------------------------------------------------
1.559 + Direct ViewFinder : RECamV2DirectViewFinderTest
1.560 + *------------------------------------------------------*/
1.561 +RECamV2DirectViewFinderTest* RECamV2DirectViewFinderTest::NewL(const TDesC& aTestStep)
1.562 + {
1.563 + RECamV2DirectViewFinderTest* self = new (ELeave) RECamV2DirectViewFinderTest(aTestStep);
1.564 + return self;
1.565 + }
1.566 +
1.567 +RECamV2DirectViewFinderTest::RECamV2DirectViewFinderTest(const TDesC& aTestStep)
1.568 + {
1.569 + iTestStepName.Copy(aTestStep);
1.570 + }
1.571 +
1.572 +TVerdict RECamV2DirectViewFinderTest::DoTestStepL()
1.573 + {
1.574 + if(!iTestStepName.Compare(_L("MM-ECM-ADV-U-052-HP")))
1.575 + {
1.576 + return DoTestStep_52L();
1.577 + }
1.578 + return EInconclusive;
1.579 + }
1.580 +
1.581 +TVerdict RECamV2DirectViewFinderTest::DoTestStep_52L()
1.582 + {
1.583 + TVerdict verdict = EFail;
1.584 + INFO_PRINTF1(_L("Alloc test"));
1.585 + TInt i;
1.586 + TInt err;
1.587 + for (i = 1 ; ; i++)
1.588 + {
1.589 + __MM_HEAP_MARK;
1.590 +
1.591 + if (i % 5 == 0)
1.592 + {
1.593 + INFO_PRINTF2(_L("Fail count = %d"), i);
1.594 + }
1.595 +
1.596 + __UHEAP_SETFAIL(RHeap::EFailNext, i);
1.597 +
1.598 + TRAP(err, verdict = DoV2DirectVFTestStepL());
1.599 +
1.600 + TAny* testAlloc = User::Alloc(1);
1.601 + TBool heapTestingComplete = (testAlloc == NULL) && (err==KErrNone);
1.602 + User::Free(testAlloc);
1.603 +
1.604 + __UHEAP_RESET;
1.605 + __MM_HEAP_MARKEND;
1.606 +
1.607 + if ((err != KErrNoMemory ) || heapTestingComplete)
1.608 + {
1.609 + INFO_PRINTF4(_L("err = %d, verdict = %d, Fail count = %d"), err, verdict, i);
1.610 + INFO_PRINTF1(_L("Alloc testing completed successfully"));
1.611 + verdict = EPass;
1.612 + break;
1.613 + }
1.614 + }
1.615 + return verdict;
1.616 + }
1.617 +
1.618 +TVerdict RECamV2DirectViewFinderTest::DoV2DirectVFTestStepL()
1.619 + {
1.620 + TVerdict result = EPass;
1.621 + CCamera* camera = NULL;
1.622 +
1.623 + MCameraObserver* observer = NULL;
1.624 + MDirectViewFinderObserver* directVFObserver = NULL;
1.625 +
1.626 + TInt error = KErrNone;
1.627 + CCamera::CCameraV2DirectViewFinder* directVF = NULL;
1.628 +
1.629 + // using observer
1.630 + __MM_HEAP_MARK;
1.631 + INFO_PRINTF1(_L("Create camera using Camera::NewL() and MCameraObserver"));
1.632 + TRAP(error, camera = CCamera::NewL(*observer, 0));
1.633 + if (error==KErrNone)
1.634 + {
1.635 + CleanupStack::PushL(camera);
1.636 + INFO_PRINTF1(_L("Create v2 direct viewfinder from CCamera object"));
1.637 +
1.638 + TRAP(error, directVF = CCamera::CCameraV2DirectViewFinder::NewL(*camera, *directVFObserver));
1.639 + if (error==KErrExtensionNotSupported)
1.640 + {
1.641 + INFO_PRINTF1(_L("CCameraV2DirectViewFinder object creation using old Observer failed with correct error"));
1.642 + }
1.643 + else
1.644 + {
1.645 + INFO_PRINTF1(_L("CCameraV2DirectViewFinder object creation using old Observer gave unexpected result"));
1.646 + result = EFail;
1.647 + }
1.648 + CleanupStack::PopAndDestroy(camera);
1.649 + }
1.650 + else
1.651 + {
1.652 + INFO_PRINTF2(_L("Unexpected %d return from CCamera::NewL()"), error);
1.653 + result = EFail;
1.654 + User::Leave(KErrNoMemory);
1.655 + }
1.656 + __MM_HEAP_MARKEND;
1.657 +
1.658 + // using observer2 with NewL
1.659 + MCameraObserver2* observer2 = NULL;
1.660 + __MM_HEAP_MARK;
1.661 + INFO_PRINTF1(_L("Create camera using Camera::NewL() and MCameraObserver2"));
1.662 + TRAP(error, camera = CCamera::NewL(*observer2, 0,0));
1.663 + if (error==KErrNone)
1.664 + {
1.665 + CleanupStack::PushL(camera);
1.666 + INFO_PRINTF1(_L("Create v2 direct viewfinder from CCamera object"));
1.667 +
1.668 + TRAP(error, directVF = CCamera::CCameraV2DirectViewFinder::NewL(*camera, *directVFObserver));
1.669 + if (error==KErrExtensionNotSupported)
1.670 + {
1.671 + INFO_PRINTF1(_L("CCameraV2DirectViewFinder object creation using Observer2 with NewL failed with correct error"));
1.672 + }
1.673 + else
1.674 + {
1.675 + INFO_PRINTF1(_L("CCameraV2DirectViewFinder object creation using Observer2 with NewL gave unexpected result"));
1.676 + result = EFail;
1.677 + }
1.678 + CleanupStack::PopAndDestroy(camera);
1.679 + }
1.680 + else
1.681 + {
1.682 + INFO_PRINTF2(_L("Unexpected %d return from CCamera::NewL()"), error);
1.683 + result = EFail;
1.684 + User::Leave(KErrNoMemory);
1.685 + }
1.686 + __MM_HEAP_MARKEND;
1.687 +
1.688 + // create v2 direct viewfinder object using New2L
1.689 + __MM_HEAP_MARK;
1.690 + INFO_PRINTF1(_L("Create camera using Camera::New2L() and MCameraObserver2"));
1.691 +
1.692 + TRAP(error, camera = CCamera::New2L(*observer2, 0,0));
1.693 + if (error==KErrNone)
1.694 + {
1.695 + CleanupStack::PushL(camera);
1.696 + INFO_PRINTF1(_L("KErrNone return from CCamera::New2L()"));
1.697 + TRAP(error, directVF = CCamera::CCameraV2DirectViewFinder::NewL(*camera, *directVFObserver));
1.698 +
1.699 + if (error==KErrNone)
1.700 + {
1.701 + CleanupStack::PushL(directVF);
1.702 + INFO_PRINTF1(_L("CCameraV2DirectViewFinder object was created using NewL"));
1.703 + CleanupStack::PopAndDestroy(directVF);
1.704 + }
1.705 + else
1.706 + {
1.707 + INFO_PRINTF1(_L("CCameraV2DirectViewFinder object was not created using NewL"));
1.708 + result = EFail;
1.709 + User::Leave(KErrNoMemory);
1.710 + }
1.711 + CleanupStack::PopAndDestroy(camera);
1.712 + }
1.713 + else
1.714 + {
1.715 + INFO_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
1.716 + result = EFail;
1.717 + User::Leave(KErrNoMemory);
1.718 + }
1.719 + __MM_HEAP_MARKEND;
1.720 +
1.721 + return result;
1.722 + }
1.723 +
1.724 +/*------------------------------------------------------
1.725 + Direct ViewFinder : RECamV2DirectVFNotificationTest
1.726 + *------------------------------------------------------*/
1.727 +RECamV2DirectVFNotificationTest* RECamV2DirectVFNotificationTest::NewL(TBool aAllocTest)
1.728 + {
1.729 + RECamV2DirectVFNotificationTest* self = new (ELeave) RECamV2DirectVFNotificationTest(aAllocTest);
1.730 + CleanupStack::PushL(self);
1.731 + self->ConstructL();
1.732 + CleanupStack::Pop(self);
1.733 + return self;
1.734 + }
1.735 +
1.736 +void RECamV2DirectVFNotificationTest::ConstructL()
1.737 + {
1.738 + }
1.739 +
1.740 +RECamV2DirectVFNotificationTest::RECamV2DirectVFNotificationTest(TBool /*aAllocTest*/)
1.741 + {
1.742 + iTestStepName = _L("MM-ECM-ADV-U-053-HP");
1.743 + }
1.744 +
1.745 +void RECamV2DirectVFNotificationTest::DirectViewFinderFirstFrameDisplayed(CCamera::CCameraV2DirectViewFinder& aDirectViewFinderHandle, TInt aErrorCode)
1.746 + {
1.747 + aDirectViewFinderHandle.GetViewFinderHandleL(iVFHandle);
1.748 + iError = aErrorCode;
1.749 + }
1.750 +
1.751 +void RECamV2DirectVFNotificationTest::DirectHistogramDisplayed(CCamera::CCameraV2DirectViewFinder& aDirectViewFinderHandle, CCamera::CCameraV2Histogram& /*aDirectHistogramDisplayed*/, TInt aErrorCode)
1.752 + {
1.753 + aDirectViewFinderHandle.GetViewFinderHandleL(iVFHandle);
1.754 + iError = aErrorCode;
1.755 + }
1.756 +
1.757 +void RECamV2DirectVFNotificationTest::ClientHistogramReady(CCamera::CCameraV2DirectViewFinder& aDirectViewFinderHandle, MHistogramV2Buffer* /*aClientHistogramBuffer*/, TInt aErrorCode)
1.758 + {
1.759 + aDirectViewFinderHandle.GetViewFinderHandleL(iVFHandle);
1.760 + iError = aErrorCode;
1.761 + }
1.762 +
1.763 +void RECamV2DirectVFNotificationTest::DirectViewFinderFailed(CCamera::CCameraV2DirectViewFinder& aDirectViewFinderHandle, TInt aErrorCode)
1.764 + {
1.765 + aDirectViewFinderHandle.GetViewFinderHandleL(iVFHandle);
1.766 + iError = aErrorCode;
1.767 + }
1.768 +
1.769 +void RECamV2DirectVFNotificationTest::DirectSnapshotForImageDisplayed(CCamera::CCameraV2DirectViewFinder& aDirectViewFinderHandle, CCamera::CCameraImageCapture& /*aCaptureImageHandle*/, TPostCaptureControlId /*aPostCaptureControlId*/, TInt aErrorCode)
1.770 + {
1.771 + aDirectViewFinderHandle.GetViewFinderHandleL(iVFHandle);
1.772 + iError = aErrorCode;
1.773 + }
1.774 +
1.775 +TInt RECamV2DirectVFNotificationTest::CustomInterface(TUid /*aInterface*/, TAny*& /*aPtrInterface*/)
1.776 + {
1.777 + return KErrNone;
1.778 + }
1.779 +
1.780 +void RECamV2DirectVFNotificationTest::CheckViewFinderNegNotification(TInt aVFHandle, TVerdict& aResult)
1.781 + {
1.782 + INFO_PRINTF4(_L("Expected DirectViewFinder Id %d, received event %x. Error %d."), aVFHandle, iVFHandle, iError);
1.783 + if (aVFHandle != iVFHandle || iError != KErrNotSupported)
1.784 + {
1.785 + aResult = EFail;
1.786 + }
1.787 + }
1.788 +
1.789 +TVerdict RECamV2DirectVFNotificationTest::DoTestStepL()
1.790 + {
1.791 + TVerdict verdict = EFail;
1.792 + INFO_PRINTF1(_L("Alloc test"));
1.793 +
1.794 + TInt i, err;
1.795 +
1.796 + for (i =1; ;i++)
1.797 + {
1.798 + if (i % 5 == 0)
1.799 + {
1.800 + INFO_PRINTF2(_L("Fail count = %d"), i);
1.801 + }
1.802 +
1.803 + __UHEAP_SETFAIL(RHeap::EFailNext,i);
1.804 + __MM_HEAP_MARK;
1.805 +
1.806 + TRAP(err,verdict = DoTestStep_53L());
1.807 +
1.808 + TAny* testAlloc = User::Alloc(1);
1.809 + TBool heapTestingComplete = ((testAlloc == NULL ) && (err == KErrNone));
1.810 + User::Free(testAlloc);
1.811 +
1.812 + if ((err != KErrNoMemory && verdict == EPass) || heapTestingComplete)
1.813 + {
1.814 + INFO_PRINTF4(_L("err = %d, verdict = %d, Fail count = %d"), err, verdict, i);
1.815 + INFO_PRINTF1(_L("Alloc testing completed successfully"));
1.816 + verdict = EPass;
1.817 + break;
1.818 + }
1.819 +
1.820 + __MM_HEAP_MARKEND;
1.821 + __UHEAP_RESET;
1.822 + }
1.823 + return verdict;
1.824 + }
1.825 +
1.826 +TVerdict RECamV2DirectVFNotificationTest::DoTestStep_53L()
1.827 + {
1.828 + TVerdict result = EPass;
1.829 + CCamera* camera = NULL;
1.830 +
1.831 + TInt error = KErrNone;
1.832 + CCamera::CCameraV2DirectViewFinder* directVF = NULL;
1.833 +
1.834 + // create client viewfinder object using New2L
1.835 + __MM_HEAP_MARK;
1.836 + INFO_PRINTF1(_L("Create camera using Camera::New2L() and MCameraObserver2"));
1.837 +
1.838 + TRAP(error, camera = CCamera::New2L(*this, 0, 0));
1.839 +
1.840 + if (error==KErrNone)
1.841 + {
1.842 + CleanupStack::PushL(camera);
1.843 + INFO_PRINTF1(_L("KErrNone return from CCamera::New2L()"));
1.844 + TRAP(error, directVF = CCamera::CCameraV2DirectViewFinder::NewL(*camera, *this));
1.845 +
1.846 + if (error==KErrNone)
1.847 + {
1.848 + CleanupStack::PushL(directVF);
1.849 + INFO_PRINTF1(_L("CCameraV2DirectViewFinder object was created using NewL"));
1.850 + //Test Direct ViewFinder APIs
1.851 + INFO_PRINTF1(_L("Create Histogram for Direct ViewFinder"));
1.852 + CCamera::CCameraV2Histogram* histogram_DVF = directVF->CreateHistogramHandleL();
1.853 + if(!histogram_DVF)
1.854 + {
1.855 + INFO_PRINTF1(_L("Histogram creation for Direct ViewFinder unsuccessful"));
1.856 + result = EFail;
1.857 + }
1.858 +
1.859 + CleanupStack::PushL(histogram_DVF);
1.860 +
1.861 + INFO_PRINTF1(_L("Create ImageProcessing for Direct ViewFinder"));
1.862 +
1.863 + TRAPD(err, directVF->GetTransformationHandleL());
1.864 + if(err != KErrNotSupported)
1.865 + {
1.866 + INFO_PRINTF1(_L("ImageProcessing creation for Direct ViewFinder: unexpected result!"));
1.867 + result = EFail;
1.868 + }
1.869 +
1.870 + //set properties for direct VF (base class)
1.871 + INFO_PRINTF1(_L("GetViewFinderFadingCapabilitiesL for Direct ViewFinder"));
1.872 + CCameraViewFinder::TViewFinderFadingCapabilities fadingCapabilities;
1.873 + TRAP(err,directVF->GetViewFinderFadingCapabilitiesL(fadingCapabilities));
1.874 + if(err != KErrNotSupported)
1.875 + {
1.876 + INFO_PRINTF1(_L("GetViewFinderFadingCapabilitiesL for Direct ViewFinder: unexpected result!"));
1.877 + result = EFail;
1.878 + }
1.879 +
1.880 + INFO_PRINTF1(_L("GetViewFinderFadingEffectL for Direct ViewFinder"));
1.881 + CCameraViewFinder::TViewFinderFadingEffect fadingEffect;
1.882 + TRAP(err,directVF->GetViewFinderFadingEffectL(fadingEffect));
1.883 + if(err != KErrNotSupported)
1.884 + {
1.885 + INFO_PRINTF1(_L("GetViewFinderFadingEffectL for Direct ViewFinder: unexpected result!"));
1.886 + result = EFail;
1.887 + }
1.888 +
1.889 + INFO_PRINTF1(_L("SetViewFinderFadingEffectL for Direct ViewFinder"));
1.890 + iInputEventUid = KUidECamEvent2ViewFinderFadingEffect;
1.891 + directVF->SetViewFinderFadingEffectL(fadingEffect);
1.892 + CheckNotificationNeg(iInputEventUid, result);
1.893 +
1.894 + TInt vfHandle=-1;
1.895 + directVF->GetViewFinderHandleL(vfHandle);
1.896 +
1.897 + //set properties for histogram (for viewfinder)
1.898 + TUint supportedHistogramType=0;
1.899 + histogram_DVF->GetSupportedHistogramsL(supportedHistogramType);
1.900 + if(supportedHistogramType!=0)
1.901 + {
1.902 + INFO_PRINTF1(_L("unexpected GetSupportedHistogramsL"));
1.903 + result = EFail;
1.904 + }
1.905 +
1.906 + INFO_PRINTF1(_L("GetDirectHistogramSupportInfoL for Histogram for Direct ViewFinder"));
1.907 + TBool directHistogramSupported = EFalse;
1.908 + TRAP(err,histogram_DVF->GetDirectHistogramSupportInfoL(directHistogramSupported));
1.909 + if(err != KErrNotSupported)
1.910 + {
1.911 + INFO_PRINTF1(_L("GetDirectHistogramSupportInfoL for Histogram for Direct ViewFinder: unexpected result!"));
1.912 + result = EFail;
1.913 + }
1.914 +
1.915 + INFO_PRINTF1(_L("PrepareClientHistogramL for Histogram for Direct ViewFinder"));
1.916 + CCamera::CCameraV2Histogram::THistogramType histogramType = CCamera::CCameraV2Histogram::EHistNone;
1.917 + TRAP(err,histogram_DVF->PrepareClientHistogramL(histogramType));
1.918 + if(err != KErrNotSupported)
1.919 + {
1.920 + INFO_PRINTF1(_L("PrepareClientHistogramL for Histogram for Direct ViewFinder: unexpected result!"));
1.921 + result = EFail;
1.922 + }
1.923 +
1.924 + INFO_PRINTF1(_L("PrepareDirectHistogramL for Histogram for Direct ViewFinder"));
1.925 + CCamera::CCameraV2Histogram::TDirectHistogramParameters histogramParameters;
1.926 + TRAP(err,histogram_DVF->PrepareDirectHistogramL(histogramParameters));
1.927 + if(err != KErrNotSupported)
1.928 + {
1.929 + INFO_PRINTF1(_L("PrepareDirectHistogramL for Histogram for Direct ViewFinder: unexpected result!"));
1.930 + result = EFail;
1.931 + }
1.932 +
1.933 + INFO_PRINTF1(_L("UpdateDirectHistogramPropertiesL for Histogram for Direct ViewFinder"));
1.934 + TRAP(err,histogram_DVF->UpdateDirectHistogramPropertiesL(histogramParameters));
1.935 + if(err != KErrNotSupported)
1.936 + {
1.937 + INFO_PRINTF1(_L("UpdateDirectHistogramPropertiesL for Histogram for Direct ViewFinder: unexpected result!"));
1.938 + result = EFail;
1.939 + }
1.940 +
1.941 + INFO_PRINTF1(_L("GetDirectHistogramPropertiesL for Histogram for Direct ViewFinder"));
1.942 + TRAP(err,histogram_DVF->GetDirectHistogramPropertiesL(histogramParameters));
1.943 + if(err != KErrNotSupported)
1.944 + {
1.945 + INFO_PRINTF1(_L("GetDirectHistogramPropertiesL for Histogram for Direct ViewFinder: unexpected result!"));
1.946 + result = EFail;
1.947 + }
1.948 +
1.949 + INFO_PRINTF1(_L("GetHistogramStateL for Histogram for Direct ViewFinder"));
1.950 + TBool histogramActive = EFalse;
1.951 + TRAP(err,histogram_DVF->GetHistogramStateL(histogramActive));
1.952 + if(err != KErrNotSupported)
1.953 + {
1.954 + INFO_PRINTF1(_L("GetHistogramStateL for Histogram for Direct ViewFinder: unexpected result!"));
1.955 + result = EFail;
1.956 + }
1.957 +
1.958 + //viewfinder starting...
1.959 + INFO_PRINTF1(_L("StartViewFinderDirectL for Direct ViewFinder"));
1.960 + TSize size(320,240);
1.961 + TRect rect(TPoint(0,0),size);
1.962 + TRect cliprect(rect);
1.963 + RWsSession ws;
1.964 + CWsScreenDevice* screenDevice = NULL;
1.965 + RWindow window;
1.966 + TRAP(err,directVF->StartViewFinderDirectL(ws, *screenDevice, window, rect));
1.967 + if(err != KErrNone)
1.968 + {
1.969 + INFO_PRINTF1(_L("StartViewFinderDirectL for Direct ViewFinder: unexpected result!"));
1.970 + result = EFail;
1.971 + }
1.972 + CheckViewFinderNegNotification(vfHandle, result);
1.973 +
1.974 + TRAP(err,directVF->StartViewFinderDirectL(ws, *screenDevice, window, rect, cliprect));
1.975 + if(err != KErrNone)
1.976 + {
1.977 + INFO_PRINTF1(_L("StartViewFinderDirectL (with cliprect) for Direct ViewFinder: unexpected result!"));
1.978 + result = EFail;
1.979 + }
1.980 + CheckViewFinderNegNotification(vfHandle, result);
1.981 +
1.982 + INFO_PRINTF1(_L("GetDirectViewFinderPropertiesL for Direct ViewFinder"));
1.983 + TInt screenNumber=0;
1.984 + TRAP(err,directVF->GetDirectViewFinderPropertiesL(screenNumber, rect, cliprect));
1.985 + if(err != KErrNotSupported)
1.986 + {
1.987 + INFO_PRINTF1(_L("GetDirectViewFinderPropertiesL for Direct ViewFinder: unexpected result!"));
1.988 + result = EFail;
1.989 + }
1.990 +
1.991 + INFO_PRINTF1(_L("PauseViewFinderDirect for Direct ViewFinder"));
1.992 + directVF->PauseViewFinderDirect();
1.993 +
1.994 + INFO_PRINTF1(_L("ResumeViewFinderDirect for Direct ViewFinder"));
1.995 + directVF->ResumeViewFinderDirect();
1.996 + CheckViewFinderNegNotification(vfHandle, result);
1.997 +
1.998 + INFO_PRINTF1(_L("StartHistogram for Direct ViewFinder"));
1.999 + histogram_DVF->StartHistogram();
1.1000 + CheckViewFinderNegNotification(vfHandle, result);
1.1001 +
1.1002 + INFO_PRINTF1(_L("StopHistogram for Direct ViewFinder"));
1.1003 + histogram_DVF->StopHistogram();
1.1004 +
1.1005 + INFO_PRINTF1(_L("GetViewFinderStateL for Direct ViewFinder"));
1.1006 + CCamera::CCameraV2DirectViewFinder::TViewFinderState vfState = CCamera::CCameraV2DirectViewFinder::EViewFinderInActive;
1.1007 + TRAP(err,directVF->GetViewFinderStateL(vfState));
1.1008 + if(err != KErrNotSupported)
1.1009 + {
1.1010 + INFO_PRINTF1(_L("GetViewFinderStateL for Direct ViewFinder: unexpected result!"));
1.1011 + result = EFail;
1.1012 + }
1.1013 +
1.1014 + //access direct snapshot functionality
1.1015 + INFO_PRINTF1(_L("Access direct snapshot functionality"));
1.1016 + CCamera::CCameraDirectSnapshot* directSnapshot = directVF->GetDirectSnapshotHandleL();
1.1017 + if(directSnapshot == NULL)
1.1018 + {
1.1019 + INFO_PRINTF1(_L("Direct Snapshot creation for Direct ViewFinder unsuccessful"));
1.1020 + result = EFail;
1.1021 + }
1.1022 +
1.1023 + CleanupStack::PushL(directSnapshot);
1.1024 +
1.1025 + INFO_PRINTF1(_L("Get parent viewfinder for direct snapshot"));
1.1026 + CCamera::CCameraV2DirectViewFinder* directViewFinder = NULL;
1.1027 + TRAP(err, directSnapshot->GetDirectViewFinderL(directViewFinder));
1.1028 + if(err != KErrNone)
1.1029 + {
1.1030 + INFO_PRINTF1(_L("GetDirectViewFinderL for Direct ViewFinder Snapshot: unexpected result!"));
1.1031 + result = EFail;
1.1032 + }
1.1033 +
1.1034 + TInt viewfinderHandle = -1;
1.1035 + directViewFinder->GetViewFinderHandleL(viewfinderHandle);
1.1036 + if(vfHandle != viewfinderHandle)
1.1037 + {
1.1038 + INFO_PRINTF1(_L("Parent Viewfinder for Direct ViewFinder Snapshot: unexpected result!"));
1.1039 + result = EFail;
1.1040 + }
1.1041 +
1.1042 + CCamera::CCameraDirectSnapshot::TDirectSnapshotParameters directSnapshotParameters;
1.1043 +
1.1044 + if(directSnapshotParameters.Size() != sizeof(CCamera::CCameraDirectSnapshot::TDirectSnapshotParameters) ||
1.1045 + directSnapshotParameters.Version() != KECamDirectSnapshotParametersCurrentVersion)
1.1046 + {
1.1047 + INFO_PRINTF1(_L("TDirectSnapshotParameters has different version for Direct Snapshot: unexpected result!"));
1.1048 + result = EFail;
1.1049 + }
1.1050 +
1.1051 + INFO_PRINTF1(_L("SetAspectRatioState for Direct Snapshot"));
1.1052 + directSnapshotParameters.SetAspectRatioState(ETrue);
1.1053 + TBool aspectRatioState = directSnapshotParameters.IsAspectRatioMaintained();
1.1054 + if(!aspectRatioState)
1.1055 + {
1.1056 + INFO_PRINTF1(_L("AspectRatioState for Direct Snapshot: unexpected result!"));
1.1057 + result = EFail;
1.1058 + }
1.1059 +
1.1060 + directSnapshotParameters.SetAspectRatioState(EFalse);
1.1061 + aspectRatioState = directSnapshotParameters.IsAspectRatioMaintained();
1.1062 + if(aspectRatioState != EFalse)
1.1063 + {
1.1064 + INFO_PRINTF1(_L("AspectRatioState for Direct Snapshot: unexpected result!"));
1.1065 + result = EFail;
1.1066 + }
1.1067 +
1.1068 + INFO_PRINTF1(_L("EnableDirectSnapshotL for Direct Snapshot"));
1.1069 + TRAP(err, directSnapshot->EnableDirectSnapshotL(directSnapshotParameters));
1.1070 + if(err != KErrNone)
1.1071 + {
1.1072 + INFO_PRINTF1(_L("EnableDirectSnapshotL for DirectSnapshot: unexpected result!"));
1.1073 + result = EFail;
1.1074 + }
1.1075 +
1.1076 + INFO_PRINTF1(_L("GetDirectSnapshotStateL for Direct Snapshot"));
1.1077 + CCamera::CCameraDirectSnapshot::TDirectSnapshotState directSnapshotState;
1.1078 + TRAP(err, directSnapshot->GetDirectSnapshotStateL(directSnapshotState));
1.1079 + if(err != KErrNone)
1.1080 + {
1.1081 + INFO_PRINTF1(_L("GetDirectSnapshotStateL for DirectSnapshot: unexpected result!"));
1.1082 + result = EFail;
1.1083 + }
1.1084 +
1.1085 + if(CCamera::CCameraDirectSnapshot::EDirectSnapshotEnabled != directSnapshotState)
1.1086 + {
1.1087 + INFO_PRINTF1(_L("DirectSnapshotState not set properly: unexpected result!"));
1.1088 + result = EFail;
1.1089 + }
1.1090 +
1.1091 + INFO_PRINTF1(_L("GetDirectSnapshotParametersL for Direct Snapshot"));
1.1092 + CCamera::CCameraDirectSnapshot::TDirectSnapshotParameters directSnapshotParam;
1.1093 + TRAP(err, directSnapshot->GetDirectSnapshotParametersL(directSnapshotParam));
1.1094 + if(err != KErrNone)
1.1095 + {
1.1096 + INFO_PRINTF1(_L("GetDirectSnapshotParametersL for DirectSnapshot: unexpected result!"));
1.1097 + result = EFail;
1.1098 + }
1.1099 +
1.1100 + if(directSnapshotParam.IsAspectRatioMaintained() != directSnapshotParameters.IsAspectRatioMaintained())
1.1101 + {
1.1102 + INFO_PRINTF1(_L("DirectSnapshotParameters for DirectSnapshot wrongly set: unexpected result!"));
1.1103 + result = EFail;
1.1104 + }
1.1105 +
1.1106 + INFO_PRINTF1(_L("SetDirectSnapshotParametersL for Direct Snapshot"));
1.1107 + directSnapshotParameters.SetAspectRatioState(ETrue);
1.1108 + TRAP(err, directSnapshot->SetDirectSnapshotParametersL(directSnapshotParameters));
1.1109 + if(err != KErrNone)
1.1110 + {
1.1111 + INFO_PRINTF1(_L("SetDirectSnapshotParametersL for DirectSnapshot: unexpected result!"));
1.1112 + result = EFail;
1.1113 + }
1.1114 +
1.1115 + INFO_PRINTF1(_L("DisableDirectSnapshot for Direct Snapshot"));
1.1116 + directSnapshot->DisableDirectSnapshot();
1.1117 + TRAP(err, directSnapshot->GetDirectSnapshotStateL(directSnapshotState));
1.1118 + if(err != KErrNone)
1.1119 + {
1.1120 + INFO_PRINTF1(_L("GetDirectSnapshotStateL for DirectSnapshot: unexpected result!"));
1.1121 + result = EFail;
1.1122 + }
1.1123 +
1.1124 + if(CCamera::CCameraDirectSnapshot::EDirectSnapshotDisabled != directSnapshotState)
1.1125 + {
1.1126 + INFO_PRINTF1(_L("GetDirectSnapshotStateL for DirectSnapshot: unexpected result!"));
1.1127 + result = EFail;
1.1128 + }
1.1129 +
1.1130 + INFO_PRINTF1(_L("StopDirectViewFinder for Direct ViewFinder"));
1.1131 + directVF->StopDirectViewFinder();
1.1132 +
1.1133 + CleanupStack::PopAndDestroy(directSnapshot);
1.1134 + CleanupStack::PopAndDestroy(histogram_DVF);
1.1135 + CleanupStack::PopAndDestroy(directVF);
1.1136 + }
1.1137 + else
1.1138 + {
1.1139 + INFO_PRINTF1(_L("CCameraV2DirectViewFinder object not created"));
1.1140 + result = EFail;
1.1141 + }
1.1142 + CleanupStack::PopAndDestroy(camera);
1.1143 + }
1.1144 + else
1.1145 + {
1.1146 + INFO_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
1.1147 + result = EFail;
1.1148 + }
1.1149 + __MM_HEAP_MARKEND;
1.1150 +
1.1151 + return result;
1.1152 + }
1.1153 +/*------------------------------------------------------------------
1.1154 + Pre Image Capture Control : RECamPreImgCaptureNotificationTest
1.1155 + *-----------------------------------------------------------------*/
1.1156 +RECamPreImgCaptureNotificationTest* RECamPreImgCaptureNotificationTest::NewL(TBool aAllocTest)
1.1157 + {
1.1158 + return new (ELeave)RECamPreImgCaptureNotificationTest(aAllocTest);
1.1159 + }
1.1160 +
1.1161 +RECamPreImgCaptureNotificationTest::RECamPreImgCaptureNotificationTest(TBool /*aAllocTest*/)
1.1162 + {
1.1163 + iTestStepName = _L("MM-ECM-ADV-U-054-HP");
1.1164 + iCaptureImageHandle = NULL;
1.1165 + }
1.1166 +
1.1167 +void RECamPreImgCaptureNotificationTest::PrepareImageComplete(CCamera::CCameraImageCapture* aCaptureImageHandle, TInt aErrorCode)
1.1168 + {
1.1169 + iCaptureImageHandle = aCaptureImageHandle;
1.1170 + iError = aErrorCode;
1.1171 + }
1.1172 +
1.1173 +TInt RECamPreImgCaptureNotificationTest::CustomInterface(TUid /*aInterface*/, TAny*& /*aPtrInterface*/)
1.1174 + {
1.1175 + return KErrNone;
1.1176 + }
1.1177 +
1.1178 +void RECamPreImgCaptureNotificationTest::CheckCaptureNotification(CCamera::CCameraImageCapture*& aImageCapture, TVerdict& aResult)
1.1179 + {
1.1180 + INFO_PRINTF2(_L("Pre Image Capture Control Error %d, "), iError);
1.1181 + if (iError != KErrNone)
1.1182 + {
1.1183 + aResult = EFail;
1.1184 + }
1.1185 + else
1.1186 + {
1.1187 + aImageCapture = iCaptureImageHandle;
1.1188 + }
1.1189 + }
1.1190 +
1.1191 +TVerdict RECamPreImgCaptureNotificationTest::DoTestStepL()
1.1192 + {
1.1193 + TVerdict verdict = EFail;
1.1194 + INFO_PRINTF1(_L("Alloc test"));
1.1195 +
1.1196 + TInt i, err;
1.1197 +
1.1198 + for (i =1; ;i++)
1.1199 + {
1.1200 + if (i % 5 == 0)
1.1201 + {
1.1202 + INFO_PRINTF2(_L("Fail count = %d"), i);
1.1203 + }
1.1204 +
1.1205 + __UHEAP_SETFAIL(RHeap::EFailNext,i);
1.1206 + __MM_HEAP_MARK;
1.1207 +
1.1208 + TRAP(err,verdict = DoPreImgCaptureTestStepL());
1.1209 +
1.1210 + TAny* testAlloc = User::Alloc(1);
1.1211 + TBool heapTestingComplete = ((testAlloc == NULL ) && (err == KErrNone));
1.1212 + User::Free(testAlloc);
1.1213 +
1.1214 + if ((err != KErrNoMemory && verdict == EPass) || heapTestingComplete)
1.1215 + {
1.1216 + INFO_PRINTF4(_L("err = %d, verdict = %d, Fail count = %d"), err, verdict, i);
1.1217 + INFO_PRINTF1(_L("Alloc testing completed successfully"));
1.1218 + verdict = EPass;
1.1219 + break;
1.1220 + }
1.1221 +
1.1222 + __MM_HEAP_MARKEND;
1.1223 + __UHEAP_RESET;
1.1224 + }
1.1225 + return verdict;
1.1226 + }
1.1227 +
1.1228 +TVerdict RECamPreImgCaptureNotificationTest::DoPreImgCaptureTestStepL()
1.1229 + {
1.1230 + TVerdict result = EPass;
1.1231 + CCamera* camera = NULL;
1.1232 +
1.1233 + TInt error = KErrNone;
1.1234 + CCamera::CCameraPreImageCaptureControl* preImgCapture = NULL;
1.1235 +
1.1236 + // using observer
1.1237 + __MM_HEAP_MARK;
1.1238 + MCameraObserver* observer=NULL;
1.1239 + INFO_PRINTF1(_L("Create camera using Camera::NewL() and MCameraObserver"));
1.1240 + TRAP(error, camera = CCamera::NewL(*observer, 0));
1.1241 + if (error==KErrNone)
1.1242 + {
1.1243 + CleanupStack::PushL(camera);
1.1244 + INFO_PRINTF1(_L("Create PreImageCaptureControl from CCamera object"));
1.1245 +
1.1246 + TRAP(error, preImgCapture = CCamera::CCameraPreImageCaptureControl::NewL(*camera, *this));
1.1247 + if (error==KErrExtensionNotSupported)
1.1248 + {
1.1249 + INFO_PRINTF1(_L("CCameraPreImageCaptureControl object creation using old Observer failed with correct error"));
1.1250 + }
1.1251 + else
1.1252 + {
1.1253 + INFO_PRINTF1(_L("CCameraPreImageCaptureControl object creation using old Observer gave unexpected result"));
1.1254 + result = EFail;
1.1255 + }
1.1256 + CleanupStack::PopAndDestroy(camera);
1.1257 + }
1.1258 + else
1.1259 + {
1.1260 + INFO_PRINTF2(_L("Unexpected %d return from CCamera::NewL()"), error);
1.1261 + result = EFail;
1.1262 + User::Leave(KErrNoMemory);
1.1263 + }
1.1264 + __MM_HEAP_MARKEND;
1.1265 +
1.1266 + // using observer2 with NewL
1.1267 + __MM_HEAP_MARK;
1.1268 + INFO_PRINTF1(_L("Create camera using Camera::NewL() and MCameraObserver2"));
1.1269 + TRAP(error, camera = CCamera::NewL(*this, 0,0));
1.1270 + if (error==KErrNone)
1.1271 + {
1.1272 + CleanupStack::PushL(camera);
1.1273 + INFO_PRINTF1(_L("Create PreImageCaptureControl from CCamera object"));
1.1274 +
1.1275 + TRAP(error, preImgCapture = CCamera::CCameraPreImageCaptureControl::NewL(*camera, *this));
1.1276 + if (error==KErrExtensionNotSupported)
1.1277 + {
1.1278 + INFO_PRINTF1(_L("CCameraPreImageCaptureControl object creation using Observer2 with NewL failed with correct error"));
1.1279 + }
1.1280 + else
1.1281 + {
1.1282 + INFO_PRINTF1(_L("CCameraPreImageCaptureControl object creation using Observer2 with NewL gave unexpected result"));
1.1283 + result = EFail;
1.1284 + }
1.1285 + CleanupStack::PopAndDestroy(camera);
1.1286 + }
1.1287 + else
1.1288 + {
1.1289 + INFO_PRINTF2(_L("Unexpected %d return from CCamera::NewL()"), error);
1.1290 + result = EFail;
1.1291 + User::Leave(KErrNoMemory);
1.1292 + }
1.1293 + __MM_HEAP_MARKEND;
1.1294 +
1.1295 + // create pre image control object using New2L
1.1296 + __MM_HEAP_MARK;
1.1297 + INFO_PRINTF1(_L("Create camera using Camera::New2L() and MCameraObserver2"));
1.1298 +
1.1299 + TRAP(error, camera = CCamera::New2L(*this, 0,0));
1.1300 + if (error==KErrNone)
1.1301 + {
1.1302 + CleanupStack::PushL(camera);
1.1303 + INFO_PRINTF1(_L("KErrNone return from CCamera::New2L()"));
1.1304 + TRAP(error, preImgCapture = CCamera::CCameraPreImageCaptureControl::NewL(*camera, *this));
1.1305 +
1.1306 + if (error==KErrNone)
1.1307 + {
1.1308 + CleanupStack::PushL(preImgCapture);
1.1309 + INFO_PRINTF1(_L("CCameraPreImageCaptureControl object was created using NewL"));
1.1310 +
1.1311 + INFO_PRINTF1(_L("GetDirectSnapshotSupportInfoL for PreImageCaptureControl"));
1.1312 + TUint directSnapshotSupportInfo = 0;
1.1313 + TRAPD(err, preImgCapture->GetDirectSnapshotSupportInfoL(directSnapshotSupportInfo));
1.1314 + if(err != KErrNone)
1.1315 + {
1.1316 + INFO_PRINTF1(_L("GetDirectSnapshotSupportInfoL for PreImageCaptureControl : unexpected result!"));
1.1317 + result = EFail;
1.1318 + }
1.1319 +
1.1320 + INFO_PRINTF1(_L("GetSupportedEmbeddedStillCaptureSettingsL for PreImageCaptureControl"));
1.1321 + RArray<TUid> supportedEmbeddedStillCaptureSettings;
1.1322 + TRAP(err, preImgCapture->GetSupportedEmbeddedStillCaptureSettingsL(supportedEmbeddedStillCaptureSettings));
1.1323 + if(err != KErrNone)
1.1324 + {
1.1325 + INFO_PRINTF1(_L("GetSupportedEmbeddedStillCaptureSettingsL for PreImageCaptureControl : unexpected result!"));
1.1326 + result = EFail;
1.1327 + }
1.1328 +
1.1329 + if(supportedEmbeddedStillCaptureSettings.Count() != 0)
1.1330 + {
1.1331 + INFO_PRINTF1(_L("Number of SupportedEmbeddedStillCaptureSettings for PreImageCaptureControl : unexpected result!"));
1.1332 + result = EFail;
1.1333 + }
1.1334 +
1.1335 + INFO_PRINTF1(_L("GetSupportedDirectSavingTypeL for PreImageCaptureControl"));
1.1336 + CCamera::CCameraPreImageCaptureControl::TDirectSavingType supportedDirectSavingType
1.1337 + = CCamera::CCameraPreImageCaptureControl::EDirectSavingNotUsed;
1.1338 + TRAP(err, preImgCapture->GetSupportedDirectSavingTypeL(supportedDirectSavingType));
1.1339 + if(err != KErrNone)
1.1340 + {
1.1341 + INFO_PRINTF1(_L("GetSupportedDirectSavingTypeL for PreImageCaptureControl : unexpected result!"));
1.1342 + result = EFail;
1.1343 + }
1.1344 +
1.1345 + INFO_PRINTF1(_L("SetSequentialImageFilenameL for PreImageCaptureControl"));
1.1346 + _LIT8(KDirectSavingFileName, "C:\\ECam.jpg");
1.1347 + TInt seqNum = 0;
1.1348 + TRAP(err, preImgCapture->SetSequentialImageFilenameL(KDirectSavingFileName, seqNum));
1.1349 + if(err != KErrNotSupported)
1.1350 + {
1.1351 + INFO_PRINTF1(_L("SetSequentialImageFilenameL for PreImageCaptureControl : unexpected result!"));
1.1352 + result = EFail;
1.1353 + }
1.1354 +
1.1355 + INFO_PRINTF1(_L("SetLowerResolutionSequentialImageFilenameL for PreImageCaptureControl"));
1.1356 + _LIT8(KLowResDirectSavingFileName, "C:\\ECamLowRes.jpg");
1.1357 + TRAP(err, preImgCapture->SetLowerResolutionSequentialImageFilenameL(KLowResDirectSavingFileName, seqNum));
1.1358 + if(err != KErrNotSupported)
1.1359 + {
1.1360 + INFO_PRINTF1(_L("SetLowerResolutionSequentialImageFilenameL for PreImageCaptureControl : unexpected result!"));
1.1361 + result = EFail;
1.1362 + }
1.1363 +
1.1364 + INFO_PRINTF1(_L("GetDirectSavingTypeL for PreImageCaptureControl"));
1.1365 + CCamera::CCameraPreImageCaptureControl::TDirectSavingType directSavingType
1.1366 + = CCamera::CCameraPreImageCaptureControl::EDirectSavingNotUsed;
1.1367 + TRAP(err, preImgCapture->GetDirectSavingTypeL(directSavingType));
1.1368 + if(err != KErrNone)
1.1369 + {
1.1370 + INFO_PRINTF1(_L("GetDirectSavingTypeL for PreImageCaptureControl : unexpected result!"));
1.1371 + result = EFail;
1.1372 + }
1.1373 +
1.1374 + INFO_PRINTF1(_L("SetDirectSavingTypeL for PreImageCaptureControl"));
1.1375 + TRAP(err, preImgCapture->SetDirectSavingTypeL(CCamera::CCameraPreImageCaptureControl::EDirectSavingHighResolutionFileOnly));
1.1376 + if(err != KErrNotSupported)
1.1377 + {
1.1378 + INFO_PRINTF1(_L("SetDirectSavingTypeL for PreImageCaptureControl : unexpected result!"));
1.1379 + result = EFail;
1.1380 + }
1.1381 +
1.1382 + INFO_PRINTF1(_L("GetCaptureEventSupportInfoL for PreImageCaptureControl"));
1.1383 + TUint supportedDriveModes = 0;
1.1384 + TRAP(err, preImgCapture->GetCaptureEventSupportInfoL(supportedDriveModes));
1.1385 + if(err != KErrNone)
1.1386 + {
1.1387 + INFO_PRINTF1(_L("GetCaptureEventSupportInfoL for PreImageCaptureControl : unexpected result!"));
1.1388 + result = EFail;
1.1389 + }
1.1390 +
1.1391 + INFO_PRINTF1(_L("GetImageFormatsSupportedL for PreImageCaptureControl"));
1.1392 + TSize size(640,480);
1.1393 + TUint imageFormatsSupported = 0;
1.1394 + TRAP(err, preImgCapture->GetImageFormatsSupportedL(imageFormatsSupported, size));
1.1395 + if(err != KErrNone)
1.1396 + {
1.1397 + INFO_PRINTF1(_L("GetImageFormatsSupportedL for PreImageCaptureControl : unexpected result!"));
1.1398 + result = EFail;
1.1399 + }
1.1400 +
1.1401 + INFO_PRINTF1(_L("GetPixelAspectsSupportedL for PreImageCaptureControl"));
1.1402 + TUint pixelAspectsSupported = 0;
1.1403 + TRAP(err, preImgCapture->GetPixelAspectsSupportedL(pixelAspectsSupported, CCamera::EFormatFbsBitmapColor16M, size));
1.1404 + if(err != KErrNone)
1.1405 + {
1.1406 + INFO_PRINTF1(_L("GetPixelAspectsSupportedL for PreImageCaptureControl : unexpected result!"));
1.1407 + result = EFail;
1.1408 + }
1.1409 +
1.1410 + INFO_PRINTF1(_L("GetImageMaxMemorySizeSettingSupportInfoL for PreImageCaptureControl"));
1.1411 + TBool maxMemorySizeSettingSupported = EFalse;
1.1412 + TRAP(err, preImgCapture->GetImageMaxMemorySizeSettingSupportInfoL(maxMemorySizeSettingSupported));
1.1413 + if(err != KErrNone)
1.1414 + {
1.1415 + INFO_PRINTF1(_L("GetImageMaxMemorySizeSettingSupportInfoL for PreImageCaptureControl : unexpected result!"));
1.1416 + result = EFail;
1.1417 + }
1.1418 +
1.1419 + INFO_PRINTF1(_L("GetImageMaxMemorySizeL for PreImageCaptureControl"));
1.1420 + TUint memorySize = 0;
1.1421 + TRAP(err, preImgCapture->GetImageMaxMemorySizeL(memorySize));
1.1422 + if(err != KErrNotSupported)
1.1423 + {
1.1424 + INFO_PRINTF1(_L("GetImageMaxMemorySizeL for PreImageCaptureControl : unexpected result!"));
1.1425 + result = EFail;
1.1426 + }
1.1427 +
1.1428 + INFO_PRINTF1(_L("GetSupportedProcessingOptionsL for PreImageCaptureControl"));
1.1429 + TUint processingOptions = 0;
1.1430 + TRAP(err, preImgCapture->GetSupportedProcessingOptionsL(processingOptions));
1.1431 + if(err != KErrNotSupported)
1.1432 + {
1.1433 + INFO_PRINTF1(_L("GetSupportedProcessingOptionsL for PreImageCaptureControl : unexpected result!"));
1.1434 + }
1.1435 +
1.1436 + INFO_PRINTF1(_L("PrepareImageCapture for PreImageCaptureControl"));
1.1437 + CCamera::CCameraPreImageCaptureControl::TPrepareImageParameters prepareImageParameters;
1.1438 +
1.1439 + INFO_PRINTF1(_L("Setting processing options member variable"));
1.1440 + TUint options = 0;
1.1441 + options |= CCamera::CCameraPreImageCaptureControl::EEcamNormalProcessing;
1.1442 + prepareImageParameters.SetImageProcessingOptions(options);
1.1443 + INFO_PRINTF1(_L("Getting processing options member variable"));
1.1444 + TUint retrievedOptions = 0;
1.1445 + prepareImageParameters.GetImageProcessingOptions(retrievedOptions);
1.1446 + if(retrievedOptions != options)
1.1447 + {
1.1448 + INFO_PRINTF1(_L("Set image processing option does not match retrieved image processing option"));
1.1449 + result = EFail;
1.1450 + }
1.1451 + else
1.1452 + {
1.1453 + INFO_PRINTF1(_L("Set image processing option matches retrieved image processing option"));
1.1454 + }
1.1455 +
1.1456 + MCaptureImageObserver* captureImageObserver = NULL;
1.1457 + preImgCapture->PrepareImageCapture(prepareImageParameters, *captureImageObserver);
1.1458 + CCamera::CCameraImageCapture* imageCapture = NULL;
1.1459 + CheckCaptureNotification(imageCapture, result);
1.1460 +
1.1461 + if(imageCapture == NULL)
1.1462 + {
1.1463 + INFO_PRINTF1(_L("CCameraImageCapture object not created!"));
1.1464 + result = EFail;
1.1465 + }
1.1466 + else
1.1467 + {
1.1468 + delete imageCapture;
1.1469 + }
1.1470 +
1.1471 + CleanupStack::PopAndDestroy(preImgCapture);
1.1472 + }
1.1473 + else
1.1474 + {
1.1475 + INFO_PRINTF1(_L("CCameraPreImageCaptureControl object was not created using NewL"));
1.1476 + result = EFail;
1.1477 + }
1.1478 + CleanupStack::PopAndDestroy(camera);
1.1479 + }
1.1480 + else
1.1481 + {
1.1482 + INFO_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
1.1483 + result = EFail;
1.1484 + }
1.1485 + __MM_HEAP_MARKEND;
1.1486 +
1.1487 + return result;
1.1488 + }
1.1489 +/*------------------------------------------------------------------
1.1490 + Image Capture Control : RECamImgCaptureNotificationTest
1.1491 + *-----------------------------------------------------------------*/
1.1492 +RECamImgCaptureNotificationTest* RECamImgCaptureNotificationTest::NewL(TBool aAllocTest)
1.1493 + {
1.1494 + return new (ELeave)RECamImgCaptureNotificationTest(aAllocTest);
1.1495 + }
1.1496 +
1.1497 +RECamImgCaptureNotificationTest::RECamImgCaptureNotificationTest(TBool /*aAllocTest*/)
1.1498 + {
1.1499 + iTestStepName = _L("MM-ECM-ADV-U-055-HP");
1.1500 + iCaptureImageHandle = NULL;
1.1501 + }
1.1502 +
1.1503 +void RECamImgCaptureNotificationTest::PrepareImageComplete(CCamera::CCameraImageCapture* aCaptureImageHandle, TInt aErrorCode)
1.1504 + {
1.1505 + iCaptureImageHandle = aCaptureImageHandle;
1.1506 + iError = aErrorCode;
1.1507 + }
1.1508 +
1.1509 +TInt RECamImgCaptureNotificationTest::CustomInterface(TUid /*aInterface*/, TAny*& /*aPtrInterface*/)
1.1510 + {
1.1511 + return KErrNone;
1.1512 + }
1.1513 +
1.1514 +void RECamImgCaptureNotificationTest::CheckPreCaptureNotification(CCamera::CCameraImageCapture*& aImageCapture, TVerdict& aResult)
1.1515 + {
1.1516 + INFO_PRINTF2(_L("Pre Image Capture Control Error %d, "), iError);
1.1517 + if (iError != KErrNone)
1.1518 + {
1.1519 + aResult = EFail;
1.1520 + }
1.1521 + else
1.1522 + {
1.1523 + aImageCapture = iCaptureImageHandle;
1.1524 + }
1.1525 + }
1.1526 +
1.1527 +void RECamImgCaptureNotificationTest::IndividualImageControlHandle(CCamera::CCameraImageCapture& aCaptureImageHandle, TPostCaptureControlId aPostCaptureControlId)
1.1528 + {
1.1529 + iCaptureImageHandle = &aCaptureImageHandle;
1.1530 + iPostCaptureControlId = aPostCaptureControlId;
1.1531 + }
1.1532 +
1.1533 +void RECamImgCaptureNotificationTest::ImageBufferReady(CCamera::CCameraImageCapture& aCaptureImageHandle, TPostCaptureControlId aPostCaptureControlId, TInt aErrorCode)
1.1534 + {
1.1535 + iCaptureImageHandle = &aCaptureImageHandle;
1.1536 + iPostCaptureControlId = aPostCaptureControlId;
1.1537 + iError = aErrorCode;
1.1538 + }
1.1539 +
1.1540 +void RECamImgCaptureNotificationTest::ClientSnapshotForImageReady(CCamera::CCameraImageCapture& aCaptureImageHandle, TPostCaptureControlId aPostCaptureControlId, MCameraBuffer2* /*aSnapshotBuffer*/, TInt aErrorCode)
1.1541 + {
1.1542 + iCaptureImageHandle = &aCaptureImageHandle;
1.1543 + iPostCaptureControlId = aPostCaptureControlId;
1.1544 + iError = aErrorCode;
1.1545 + }
1.1546 +
1.1547 +void RECamImgCaptureNotificationTest::DirectSnapshotForImageDisplayed(CCamera::CCameraImageCapture& aCaptureImageHandle, TPostCaptureControlId aPostCaptureControlId, TInt aErrorCode)
1.1548 + {
1.1549 + iCaptureImageHandle = &aCaptureImageHandle;
1.1550 + iPostCaptureControlId = aPostCaptureControlId;
1.1551 + iError = aErrorCode;
1.1552 + }
1.1553 +
1.1554 +void RECamImgCaptureNotificationTest::CutDownImageDirectSavingCompleted(CCamera::CCameraImageCapture& aCaptureImageHandle, TPostCaptureControlId aPostCaptureControlId, TInt aErrorCode)
1.1555 + {
1.1556 + iCaptureImageHandle = &aCaptureImageHandle;
1.1557 + iPostCaptureControlId = aPostCaptureControlId;
1.1558 + iError = aErrorCode;
1.1559 + }
1.1560 +
1.1561 +void RECamImgCaptureNotificationTest::ImageDirectSavingCompleted(CCamera::CCameraImageCapture& aCaptureImageHandle, TPostCaptureControlId aPostCaptureControlId, TInt aErrorCode)
1.1562 + {
1.1563 + iCaptureImageHandle = &aCaptureImageHandle;
1.1564 + iPostCaptureControlId = aPostCaptureControlId;
1.1565 + iError = aErrorCode;
1.1566 + }
1.1567 +
1.1568 +void RECamImgCaptureNotificationTest::ImageCaptureComplete(CCamera::CCameraImageCapture& aCaptureImageHandle, TInt aErrorCode)
1.1569 + {
1.1570 + iCaptureImageHandle = &aCaptureImageHandle;
1.1571 + iError = aErrorCode;
1.1572 + }
1.1573 +
1.1574 +void RECamImgCaptureNotificationTest::ClientHistogramForImageReady(CCamera::CCameraImageCapture& aCaptureImageHandle, TPostCaptureControlId aPostCaptureControlId, MHistogramV2Buffer* /*aClientHistogramBuffer*/, TInt aErrorCode)
1.1575 + {
1.1576 + iCaptureImageHandle = &aCaptureImageHandle;
1.1577 + iPostCaptureControlId = aPostCaptureControlId;
1.1578 + iError = aErrorCode;
1.1579 + }
1.1580 +
1.1581 +void RECamImgCaptureNotificationTest::ClientHistogramForSnapshotReady(CCamera::CCameraImageCapture& aCaptureImageHandle, TPostCaptureControlId aPostCaptureControlId, MHistogramV2Buffer* /*aClientHistogramBuffer*/, TInt aErrorCode)
1.1582 + {
1.1583 + iCaptureImageHandle = &aCaptureImageHandle;
1.1584 + iPostCaptureControlId = aPostCaptureControlId;
1.1585 + iError = aErrorCode;
1.1586 + }
1.1587 +
1.1588 +void RECamImgCaptureNotificationTest::DirectHistogramForSnapshotDisplayed(CCamera::CCameraImageCapture& aCaptureImageHandle, TPostCaptureControlId aPostCaptureControlId, CCamera::CCameraV2Histogram& /*aDirectHistogramDisplayed*/, TInt aErrorCode)
1.1589 + {
1.1590 + iCaptureImageHandle = &aCaptureImageHandle;
1.1591 + iPostCaptureControlId = aPostCaptureControlId;
1.1592 + iError = aErrorCode;
1.1593 + }
1.1594 +
1.1595 +void RECamImgCaptureNotificationTest::ProcessingFailed(CCamera::CCameraImageCapture& aCaptureImageHandle, TPostCaptureControlId aPostCaptureControlId, TUint aProcessingTypes, TInt aErrorCode)
1.1596 + {
1.1597 + iCaptureImageHandle = &aCaptureImageHandle;
1.1598 + iPostCaptureControlId = aPostCaptureControlId;
1.1599 + iProcessingTypes = aProcessingTypes;
1.1600 + iError = aErrorCode;
1.1601 + }
1.1602 +
1.1603 +void RECamImgCaptureNotificationTest::CheckCaptureNotification(CCamera::CCameraImageCapture*& aImageCapture, TPostCaptureControlId& aPostCaptureControlId, TVerdict& aResult)
1.1604 + {
1.1605 + INFO_PRINTF2(_L("Image Capture Control Error %d, "), iError);
1.1606 + if (iError != KErrNotSupported)
1.1607 + {
1.1608 + aResult = EFail;
1.1609 + }
1.1610 + else
1.1611 + {
1.1612 + aImageCapture = iCaptureImageHandle;
1.1613 + aPostCaptureControlId = iPostCaptureControlId;
1.1614 + }
1.1615 + }
1.1616 +
1.1617 +void RECamImgCaptureNotificationTest::CheckCaptureCompletion(CCamera::CCameraImageCapture*& aImageCapture, TVerdict& aResult)
1.1618 + {
1.1619 + INFO_PRINTF2(_L("Image Capture Control Error %d, "), iError);
1.1620 + if (iError != KErrNotSupported)
1.1621 + {
1.1622 + aResult = EFail;
1.1623 + }
1.1624 + else
1.1625 + {
1.1626 + aImageCapture = iCaptureImageHandle;
1.1627 + }
1.1628 + }
1.1629 +
1.1630 +TVerdict RECamImgCaptureNotificationTest::DoTestStepL()
1.1631 + {
1.1632 + TVerdict verdict = EFail;
1.1633 + INFO_PRINTF1(_L("Alloc test"));
1.1634 +
1.1635 + TInt i,err;
1.1636 +
1.1637 + for (i = 1 ; ; i++)
1.1638 + {
1.1639 + __MM_HEAP_MARK;
1.1640 +
1.1641 + if (i % 5 == 0)
1.1642 + {
1.1643 + INFO_PRINTF2(_L("Fail count = %d"), i);
1.1644 + }
1.1645 +
1.1646 + __UHEAP_SETFAIL(RHeap::EFailNext, i);
1.1647 +
1.1648 + TRAP(err, verdict = DoImgCaptureAdvFuncConstruction());
1.1649 +
1.1650 + TAny* testAlloc = User::Alloc(1);
1.1651 + TBool heapTestingComplete = (testAlloc == NULL) && (err==KErrNone);
1.1652 + User::Free(testAlloc);
1.1653 +
1.1654 + __UHEAP_RESET;
1.1655 + __MM_HEAP_MARKEND;
1.1656 +
1.1657 + if ((err != KErrNoMemory && verdict == EPass) || heapTestingComplete)
1.1658 + {
1.1659 + INFO_PRINTF4(_L("err = %d, verdict = %d, Fail count = %d"), err, verdict, i);
1.1660 + INFO_PRINTF1(_L("Alloc testing completed successfully"));
1.1661 + verdict = EPass;
1.1662 + break;
1.1663 + }
1.1664 + }
1.1665 + return verdict;
1.1666 + }
1.1667 +
1.1668 +TVerdict RECamImgCaptureNotificationTest::DoImgCaptureAdvFuncConstruction()
1.1669 + {
1.1670 + TVerdict result = EPass;
1.1671 + CCamera* camera = NULL;
1.1672 +
1.1673 + TInt error = KErrNone;
1.1674 + CCamera::CCameraPreImageCaptureControl* preImgCapture = NULL;
1.1675 +
1.1676 + // create pre image control object using New2L
1.1677 + __MM_HEAP_MARK;
1.1678 + INFO_PRINTF1(_L("Create camera using Camera::New2L() and MCameraObserver2"));
1.1679 +
1.1680 + TRAP(error, camera = CCamera::New2L(*this, 0,0));
1.1681 + if (error==KErrNone)
1.1682 + {
1.1683 + CleanupStack::PushL(camera);
1.1684 + INFO_PRINTF1(_L("KErrNone return from CCamera::New2L()"));
1.1685 + TRAP(error, preImgCapture = CCamera::CCameraPreImageCaptureControl::NewL(*camera, *this));
1.1686 +
1.1687 + if (error==KErrNone)
1.1688 + {
1.1689 + CleanupStack::PushL(preImgCapture);
1.1690 + INFO_PRINTF1(_L("CCameraPreImageCaptureControl object was created using NewL"));
1.1691 +
1.1692 + INFO_PRINTF1(_L("PrepareImageCapture for PreImageCaptureControl"));
1.1693 + CCamera::CCameraPreImageCaptureControl::TPrepareImageParameters prepareImageParameters;
1.1694 + preImgCapture->PrepareImageCapture(prepareImageParameters, *this);
1.1695 + CCamera::CCameraImageCapture* imageCapture = NULL;
1.1696 + CheckPreCaptureNotification(imageCapture, result);
1.1697 +
1.1698 + if(imageCapture == NULL)
1.1699 + {
1.1700 + INFO_PRINTF1(_L("CCameraImageCapture object not created!"));
1.1701 + result = EFail;
1.1702 + }
1.1703 + else
1.1704 + {
1.1705 + CleanupStack::PushL(imageCapture);
1.1706 + // image capture opertions.
1.1707 +
1.1708 + INFO_PRINTF1(_L("Create Histogram for Image Capture"));
1.1709 + CCamera::CCameraV2Histogram* histogram_IC = NULL;
1.1710 + TRAP(error, histogram_IC = imageCapture->CreateHistogramHandleL());
1.1711 +
1.1712 + if(error != KErrNone /*|| !histogram_IC*/)
1.1713 + {
1.1714 + INFO_PRINTF1(_L("Histogram creation for Image Capture unsuccessful"));
1.1715 + result = EFail;
1.1716 + CleanupStack::PopAndDestroy(imageCapture);
1.1717 + CleanupStack::PopAndDestroy(preImgCapture);
1.1718 + CleanupStack::PopAndDestroy(camera);
1.1719 + User::Leave(error);
1.1720 + }
1.1721 +
1.1722 + CleanupStack::PushL(histogram_IC);
1.1723 +
1.1724 + INFO_PRINTF1(_L("Create ImageProcessing for Image Capture "));
1.1725 +
1.1726 + CCamera::CCameraImageProcessing* impProc = NULL;
1.1727 + TRAP(error, impProc = imageCapture->GetTransformationHandleL());
1.1728 +
1.1729 + if(error != KErrNone /*|| !impProc*/)
1.1730 + {
1.1731 + INFO_PRINTF1(_L("ImageProcessing creation for Image Capture unsuccessful"));
1.1732 + result = EFail;
1.1733 + CleanupStack::PopAndDestroy(histogram_IC);
1.1734 + CleanupStack::PopAndDestroy(imageCapture);
1.1735 + CleanupStack::PopAndDestroy(preImgCapture);
1.1736 + CleanupStack::PopAndDestroy(camera);
1.1737 + User::Leave(error);
1.1738 + }
1.1739 +
1.1740 + CleanupStack::PushL(impProc);
1.1741 +
1.1742 + INFO_PRINTF1(_L("Create snapshot for Image Capture"));
1.1743 + TInt viewfinderID = 0;
1.1744 + CCamera::CCameraSnapshot* snapshot_IC = NULL;
1.1745 + TRAP(error,snapshot_IC = imageCapture->GetSnapshotHandleL(viewfinderID));
1.1746 +
1.1747 + if(error != KErrNone /*||!snapshot_IC*/)
1.1748 + {
1.1749 + INFO_PRINTF1(_L("snapshot creation for Image Capture : unexpected result!"));
1.1750 + result = EFail;
1.1751 + CleanupStack::PopAndDestroy(impProc);
1.1752 + CleanupStack::PopAndDestroy(histogram_IC);
1.1753 + CleanupStack::PopAndDestroy(imageCapture);
1.1754 + CleanupStack::PopAndDestroy(preImgCapture);
1.1755 + CleanupStack::PopAndDestroy(camera);
1.1756 + User::Leave(error);
1.1757 + }
1.1758 + CleanupStack::PushL(snapshot_IC);
1.1759 +
1.1760 + INFO_PRINTF1(_L("Create histogram for snapshot for Image Capture"));
1.1761 + CCamera::CCameraV2Histogram* histogram_snapshot_IC = NULL;
1.1762 +
1.1763 + TRAP(error, histogram_snapshot_IC = snapshot_IC->CreateHistogramHandleL());
1.1764 +
1.1765 + if(error != KErrNone /*|| !histogram_snapshot_IC*/)
1.1766 + {
1.1767 + INFO_PRINTF1(_L("Histogram creation for snapshot for Image Capture unsuccessful"));
1.1768 + result = EFail;
1.1769 + CleanupStack::PopAndDestroy(snapshot_IC);
1.1770 + CleanupStack::PopAndDestroy(impProc);
1.1771 + CleanupStack::PopAndDestroy(histogram_IC);
1.1772 + CleanupStack::PopAndDestroy(imageCapture);
1.1773 + CleanupStack::PopAndDestroy(preImgCapture);
1.1774 + CleanupStack::PopAndDestroy(camera);
1.1775 + User::Leave(error);
1.1776 + }
1.1777 + CleanupStack::PushL(histogram_snapshot_IC);
1.1778 +
1.1779 + //check img proc for image capture
1.1780 + INFO_PRINTF1(_L("GetSupportedTransformationsL for imgProc for Image Capture"));
1.1781 + RArray<TUid> transformations;
1.1782 + TRAPD(err, impProc->GetSupportedTransformationsL(transformations));
1.1783 + if(err != KErrNone)
1.1784 + {
1.1785 + INFO_PRINTF1(_L("GetSupportedTransformationsL for imgProc for Image Capture : unexpected result!"));
1.1786 + result = EFail;
1.1787 + CleanupStack::PopAndDestroy(histogram_snapshot_IC);
1.1788 + CleanupStack::PopAndDestroy(snapshot_IC);
1.1789 + CleanupStack::PopAndDestroy(impProc);
1.1790 + CleanupStack::PopAndDestroy(histogram_IC);
1.1791 + CleanupStack::PopAndDestroy(imageCapture);
1.1792 + CleanupStack::PopAndDestroy(preImgCapture);
1.1793 + CleanupStack::PopAndDestroy(camera);
1.1794 + User::Leave(err);
1.1795 + }
1.1796 + if(transformations.Count() != 0)
1.1797 + {
1.1798 + INFO_PRINTF1(_L("Number of SupportedTransformations for imgProc for Image Capture : unexpected result!"));
1.1799 + result = EFail;
1.1800 + }
1.1801 + transformations.Close();
1.1802 +
1.1803 + INFO_PRINTF1(_L("Check New Img Proc methods for Image Capture"));
1.1804 + CCamera::CCameraImageProcessing::TOrientationReference orientationRef
1.1805 + = CCamera::CCameraImageProcessing::EOrientationReferenceTiltOrientation;
1.1806 + TUint suppRelativeRotation=0;
1.1807 + TUint supportedRelMirroring=0;
1.1808 + TUint supportedRelFlipping=0;
1.1809 + TRAP(err, impProc->GetSupportedRelativeOrientationOptionsL(orientationRef, suppRelativeRotation, supportedRelMirroring, supportedRelFlipping));
1.1810 + if(err != KErrNotSupported)
1.1811 + {
1.1812 + INFO_PRINTF1(_L("GetSupportedRelativeOrientationOptionsL for imgProc for Image Capture : unexpected result!"));
1.1813 + result = EFail;
1.1814 + }
1.1815 +
1.1816 + CCamera::CCameraImageProcessing::TRelativeRotation relRotation =
1.1817 + CCamera::CCameraImageProcessing::ERelativeRotation0Degrees;
1.1818 +
1.1819 + CCamera::CCameraImageProcessing::TRelativeMirror relMirror =
1.1820 + CCamera::CCameraImageProcessing::ERelativeMirrorNone;
1.1821 +
1.1822 + CCamera::CCameraImageProcessing::TRelativeFlipping relFlipping =
1.1823 + CCamera::CCameraImageProcessing::ERelativeFlippingNone;
1.1824 +
1.1825 + TRAP(err, impProc->GetCurrentRelativeOrientationOptionsL(orientationRef, relRotation, relMirror, relFlipping));
1.1826 + if(err != KErrNotSupported)
1.1827 + {
1.1828 + INFO_PRINTF1(_L("GetCurrentRelativeOrientationOptionsL for imgProc for Image Capture : unexpected result!"));
1.1829 + result = EFail;
1.1830 + CleanupStack::PopAndDestroy(histogram_snapshot_IC);
1.1831 + CleanupStack::PopAndDestroy(snapshot_IC);
1.1832 + CleanupStack::PopAndDestroy(impProc);
1.1833 + CleanupStack::PopAndDestroy(histogram_IC);
1.1834 + CleanupStack::PopAndDestroy(imageCapture);
1.1835 + CleanupStack::PopAndDestroy(preImgCapture);
1.1836 + CleanupStack::PopAndDestroy(camera);
1.1837 + User::Leave(err);
1.1838 + }
1.1839 +
1.1840 + TRAP(err, impProc->SetRelativeOrientationOptionsL(orientationRef, relRotation, relMirror, relFlipping));
1.1841 + if(err != KErrNotSupported)
1.1842 + {
1.1843 + INFO_PRINTF1(_L("SetRelativeOrientationOptionsL for imgProc for Image Capture : unexpected result!"));
1.1844 + result = EFail;
1.1845 + CleanupStack::PopAndDestroy(histogram_snapshot_IC);
1.1846 + CleanupStack::PopAndDestroy(snapshot_IC);
1.1847 + CleanupStack::PopAndDestroy(impProc);
1.1848 + CleanupStack::PopAndDestroy(histogram_IC);
1.1849 + CleanupStack::PopAndDestroy(imageCapture);
1.1850 + CleanupStack::PopAndDestroy(preImgCapture);
1.1851 + CleanupStack::PopAndDestroy(camera);
1.1852 + User::Leave(err);
1.1853 + }
1.1854 +
1.1855 + //prepare histogram for image capture
1.1856 + INFO_PRINTF1(_L("PrepareClientHistogramL for Histogram for Image Capture"));
1.1857 + CCamera::CCameraV2Histogram::THistogramType histogramType = CCamera::CCameraV2Histogram::EHistNone;
1.1858 + TRAP(err,histogram_IC->PrepareClientHistogramL(histogramType));
1.1859 + if(err != KErrNotSupported)
1.1860 + {
1.1861 + INFO_PRINTF1(_L("PrepareClientHistogramL for Histogram for Image Capture: unexpected result!"));
1.1862 + result = EFail;
1.1863 + CleanupStack::PopAndDestroy(histogram_snapshot_IC);
1.1864 + CleanupStack::PopAndDestroy(snapshot_IC);
1.1865 + CleanupStack::PopAndDestroy(impProc);
1.1866 + CleanupStack::PopAndDestroy(histogram_IC);
1.1867 + CleanupStack::PopAndDestroy(imageCapture);
1.1868 + CleanupStack::PopAndDestroy(preImgCapture);
1.1869 + CleanupStack::PopAndDestroy(camera);
1.1870 + User::Leave(err);
1.1871 + }
1.1872 +
1.1873 + //prepare snapshot for image capture
1.1874 + INFO_PRINTF1(_L("PrepareSnapshotL for Snapshot for Image Capture"));
1.1875 + CCamera::CCameraSnapshot::TSnapshotParameters snapshotParam;
1.1876 + TRAP(err,snapshot_IC->PrepareSnapshotL(snapshotParam));
1.1877 + if(err != KErrNone)
1.1878 + {
1.1879 + INFO_PRINTF1(_L("PrepareSnapshotL for Snapshot for Image Capture: unexpected result!"));
1.1880 + result = EFail;
1.1881 + CleanupStack::PopAndDestroy(histogram_snapshot_IC);
1.1882 + CleanupStack::PopAndDestroy(snapshot_IC);
1.1883 + CleanupStack::PopAndDestroy(impProc);
1.1884 + CleanupStack::PopAndDestroy(histogram_IC);
1.1885 + CleanupStack::PopAndDestroy(imageCapture);
1.1886 + CleanupStack::PopAndDestroy(preImgCapture);
1.1887 + CleanupStack::PopAndDestroy(camera);
1.1888 + User::Leave(err);
1.1889 + }
1.1890 +
1.1891 + //prepare histogram for snapshot for image capture
1.1892 + INFO_PRINTF1(_L("PrepareClientHistogramL for Histogram for snapshot for Image Capture"));
1.1893 + TRAP(err,histogram_snapshot_IC->PrepareClientHistogramL(histogramType));
1.1894 + if(err != KErrNotSupported)
1.1895 + {
1.1896 + INFO_PRINTF1(_L("PrepareClientHistogramL for Histogram for Snapshot for Image Capture: unexpected result!"));
1.1897 + result = EFail;
1.1898 + CleanupStack::PopAndDestroy(histogram_snapshot_IC);
1.1899 + CleanupStack::PopAndDestroy(snapshot_IC);
1.1900 + CleanupStack::PopAndDestroy(impProc);
1.1901 + CleanupStack::PopAndDestroy(histogram_IC);
1.1902 + CleanupStack::PopAndDestroy(imageCapture);
1.1903 + CleanupStack::PopAndDestroy(preImgCapture);
1.1904 + CleanupStack::PopAndDestroy(camera);
1.1905 + User::Leave(err);
1.1906 + }
1.1907 +
1.1908 + //image capture operations
1.1909 + INFO_PRINTF1(_L("GetPrepareImageParametersL for Image Capture"));
1.1910 + CCamera::CCameraPreImageCaptureControl::TPrepareImageParameters prepareImageParameters;
1.1911 + TRAP(err,imageCapture->GetPrepareImageParametersL(prepareImageParameters));
1.1912 + if(err != KErrNone)
1.1913 + {
1.1914 + INFO_PRINTF1(_L("GetPrepareImageParametersL for Image Capture: unexpected result!"));
1.1915 + result = EFail;
1.1916 + CleanupStack::PopAndDestroy(histogram_snapshot_IC);
1.1917 + CleanupStack::PopAndDestroy(snapshot_IC);
1.1918 + CleanupStack::PopAndDestroy(impProc);
1.1919 + CleanupStack::PopAndDestroy(histogram_IC);
1.1920 + CleanupStack::PopAndDestroy(imageCapture);
1.1921 + CleanupStack::PopAndDestroy(preImgCapture);
1.1922 + CleanupStack::PopAndDestroy(camera);
1.1923 + User::Leave(err);
1.1924 + }
1.1925 +
1.1926 + INFO_PRINTF1(_L("CaptureImage for Image Capture"));
1.1927 + imageCapture->CaptureImage();
1.1928 +
1.1929 + CCamera::CCameraImageCapture* captImg = NULL;
1.1930 + CCamera::CCameraPostImageCaptureControl* postImgCapt = NULL;
1.1931 + TPostCaptureControlId postCaptureControlId = 0;
1.1932 +
1.1933 + TRAP(err, iCaptureImageHandle->GetPostCaptureControlHandleL(postImgCapt, iPostCaptureControlId));
1.1934 + if(err != KErrNone)
1.1935 + {
1.1936 + INFO_PRINTF1(_L("GetPostCaptureControlHandleL for Image Capture: unexpected result!"));
1.1937 + result = EFail;
1.1938 + CleanupStack::PopAndDestroy(histogram_snapshot_IC);
1.1939 + CleanupStack::PopAndDestroy(snapshot_IC);
1.1940 + CleanupStack::PopAndDestroy(impProc);
1.1941 + CleanupStack::PopAndDestroy(histogram_IC);
1.1942 + CleanupStack::PopAndDestroy(imageCapture);
1.1943 + CleanupStack::PopAndDestroy(preImgCapture);
1.1944 + CleanupStack::PopAndDestroy(camera);
1.1945 + User::Leave(err);
1.1946 + }
1.1947 +
1.1948 + if(postImgCapt == NULL)
1.1949 + {
1.1950 + INFO_PRINTF1(_L("PostCaptureControl object was not provided for Image Capture: unexpected result!"));
1.1951 + result = EFail;
1.1952 + }
1.1953 + else
1.1954 + {
1.1955 + CleanupStack::PushL(postImgCapt);
1.1956 + //perform operations on post image capture control
1.1957 + INFO_PRINTF1(_L("GetPostCaptureControlId for post imgCapt object for Image Capture"));
1.1958 + TPostCaptureControlId postCaptCtrlId = 0;
1.1959 + postImgCapt->GetPostCaptureControlId(postCaptCtrlId);
1.1960 + if(postCaptCtrlId != iPostCaptureControlId)
1.1961 + {
1.1962 + INFO_PRINTF1(_L("PostCaptureControlId unexpected!"));
1.1963 + result = EFail;
1.1964 + }
1.1965 + postCaptureControlId = postCaptCtrlId;
1.1966 +
1.1967 + INFO_PRINTF1(_L("ImageCaptureHandle for post imgCapt object for Image Capture"));
1.1968 + TRAP(err, CCamera::CCameraImageCapture* captImg1 = postImgCapt->ImageCaptureHandle());
1.1969 + if(err != KErrNone /*|| captImg1 == NULL*/)
1.1970 + {
1.1971 + INFO_PRINTF1(_L("CCameraImageCapture object from post image capture object is NULL and unexpected!"));
1.1972 + result = EFail;
1.1973 + CleanupStack::PopAndDestroy(postImgCapt);
1.1974 + CleanupStack::PopAndDestroy(histogram_snapshot_IC);
1.1975 + CleanupStack::PopAndDestroy(snapshot_IC);
1.1976 + CleanupStack::PopAndDestroy(impProc);
1.1977 + CleanupStack::PopAndDestroy(histogram_IC);
1.1978 + CleanupStack::PopAndDestroy(imageCapture);
1.1979 + CleanupStack::PopAndDestroy(preImgCapture);
1.1980 + CleanupStack::PopAndDestroy(camera);
1.1981 + User::Leave(err);
1.1982 + }
1.1983 +
1.1984 + INFO_PRINTF1(_L("GetImageSequenceNumberL for post imgCapt object for Image Capture"));
1.1985 + TUint seqNum = 0;
1.1986 + TRAP(err, postImgCapt->GetImageSequenceNumberL(seqNum));
1.1987 + if(err != KErrNotSupported)
1.1988 + {
1.1989 + INFO_PRINTF1(_L("GetImageSequenceNumberL for post image capture object unexpected!"));
1.1990 + result = EFail;
1.1991 + }
1.1992 +
1.1993 + INFO_PRINTF1(_L("SetImagePriorityL for post imgCapt object for Image Capture"));
1.1994 + TECamImagePriority imagePriority = EECamImagePriorityLow;
1.1995 + TRAP(err, postImgCapt->SetImagePriorityL(imagePriority));
1.1996 + if(err != KErrNotSupported)
1.1997 + {
1.1998 + INFO_PRINTF1(_L("SetImagePriorityL for post image capture object unexpected!"));
1.1999 + result = EFail;
1.2000 + }
1.2001 +
1.2002 + INFO_PRINTF1(_L("GetImagePriorityL for post imgCapt object for Image Capture"));
1.2003 + TRAP(err, postImgCapt->GetImagePriorityL(imagePriority));
1.2004 + if(err != KErrNotSupported)
1.2005 + {
1.2006 + INFO_PRINTF1(_L("GetImagePriorityL for post image capture object unexpected!"));
1.2007 + result = EFail;
1.2008 + }
1.2009 +
1.2010 + INFO_PRINTF1(_L("PauseProcessing for post imgCapt object for Image Capture"));
1.2011 + postImgCapt->PauseProcessing(0);
1.2012 +
1.2013 + INFO_PRINTF1(_L("ResumeProcessingL for post imgCapt object for Image Capture"));
1.2014 + TRAP(err, postImgCapt->ResumeProcessingL(0));
1.2015 + if(err != KErrNotSupported)
1.2016 + {
1.2017 + INFO_PRINTF1(_L("ResumeProcessingL for post image capture object unexpected!"));
1.2018 + result = EFail;
1.2019 + }
1.2020 +
1.2021 + INFO_PRINTF1(_L("GetImageStateL for post imgCapt object for Image Capture"));
1.2022 + CCamera::CCameraPostImageCaptureControl::TImageState imgState =
1.2023 + CCamera::CCameraPostImageCaptureControl::EProcessingPending;
1.2024 + TRAP(err, postImgCapt->GetImageStateL(imgState));
1.2025 + if(err != KErrNotSupported)
1.2026 + {
1.2027 + INFO_PRINTF1(_L("GetImageStateL for post image capture object unexpected!"));
1.2028 + result = EFail;
1.2029 + }
1.2030 +
1.2031 + INFO_PRINTF1(_L("GetBufferStateL for post imgCapt object for Image Capture"));
1.2032 + CCamera::CCameraPostImageCaptureControl::TBufferState bufferState =
1.2033 + CCamera::CCameraPostImageCaptureControl::EBufferNotPresent;
1.2034 + TRAP(err, postImgCapt->GetBufferStateL(bufferState));
1.2035 + if(err != KErrNotSupported)
1.2036 + {
1.2037 + INFO_PRINTF1(_L("GetBufferStateL for post image capture object unexpected!"));
1.2038 + result = EFail;
1.2039 + }
1.2040 +
1.2041 + INFO_PRINTF1(_L("GetImageBufferL for post imgCapt object for Image Capture"));
1.2042 + MCameraImageBuffer* cameraImageBuffer = NULL;
1.2043 + TRAP(err, postImgCapt->GetImageBufferL(*cameraImageBuffer));
1.2044 + if(err != KErrNotSupported)
1.2045 + {
1.2046 + INFO_PRINTF1(_L("GetImageBufferL for post image capture object unexpected!"));
1.2047 + result = EFail;
1.2048 + }
1.2049 +
1.2050 + INFO_PRINTF1(_L("CancelImage for post imgCapt object for Image Capture"));
1.2051 + postImgCapt->CancelImage();
1.2052 + }
1.2053 +
1.2054 + CheckCaptureCompletion(captImg, result);
1.2055 +
1.2056 + //perform operations on image capture
1.2057 + INFO_PRINTF1(_L("GetNumImagesExposedL for Image Capture"));
1.2058 + TUint numImagesExposed = 0;
1.2059 + TRAP(err, imageCapture->GetNumImagesExposedL(numImagesExposed));
1.2060 + if(err != KErrNotSupported)
1.2061 + {
1.2062 + INFO_PRINTF1(_L("GetNumImagesExposedL for Image Capture unexpected!"));
1.2063 + result = EFail;
1.2064 + }
1.2065 +
1.2066 + INFO_PRINTF1(_L("GetNumTotalImagesL for Image Capture"));
1.2067 + TRAP(err, imageCapture->GetNumTotalImagesL(numImagesExposed));
1.2068 + if(err != KErrNone)
1.2069 + {
1.2070 + INFO_PRINTF1(_L("GetNumTotalImagesL for Image Capture unexpected!"));
1.2071 + result = EFail;
1.2072 + }
1.2073 +
1.2074 + INFO_PRINTF1(_L("SetCaptureImagePriorityL for Image Capture"));
1.2075 + TECamImagePriority imagePriority = EECamImagePriorityLow;
1.2076 + TRAP(err, imageCapture->SetCaptureImagePriorityL(imagePriority));
1.2077 + if(err != KErrNotSupported)
1.2078 + {
1.2079 + INFO_PRINTF1(_L("SetCaptureImagePriorityL for Image Capture unexpected!"));
1.2080 + result = EFail;
1.2081 + }
1.2082 +
1.2083 + INFO_PRINTF1(_L("GetCaptureImagePriorityL for Image Capture"));
1.2084 + TRAP(err, imageCapture->GetCaptureImagePriorityL(imagePriority));
1.2085 + if(err != KErrNotSupported)
1.2086 + {
1.2087 + INFO_PRINTF1(_L("GetCaptureImagePriorityL for Image Capture unexpected!"));
1.2088 + result = EFail;
1.2089 + }
1.2090 +
1.2091 + INFO_PRINTF1(_L("PauseProcessing for Image Capture"));
1.2092 + imageCapture->PauseProcessing(0);
1.2093 +
1.2094 + INFO_PRINTF1(_L("ResumeProcessingL for Image Capture"));
1.2095 + TRAP(err, imageCapture->ResumeProcessingL(0));
1.2096 + if(err != KErrNotSupported)
1.2097 + {
1.2098 + INFO_PRINTF1(_L("ResumeProcessingL for Image Capture unexpected!"));
1.2099 + result = EFail;
1.2100 + }
1.2101 +
1.2102 + INFO_PRINTF1(_L("CancelCaptureImage for Image Capture"));
1.2103 + imageCapture->CancelCaptureImage();
1.2104 +
1.2105 + //start histogram for image capture
1.2106 + INFO_PRINTF1(_L("StartHistogram for Image Capture"));
1.2107 + histogram_IC->StartHistogram();
1.2108 + CCamera::CCameraImageCapture* camImgCapture=NULL;
1.2109 + TPostCaptureControlId postCaptCtrlId = 0;
1.2110 + CheckCaptureNotification(camImgCapture, postCaptCtrlId, result);
1.2111 + if(camImgCapture == NULL || postCaptCtrlId != postCaptureControlId)
1.2112 + {
1.2113 + INFO_PRINTF1(_L("StartHistogram for Histogram for Image Capture unexpected!"));
1.2114 + result = EFail;
1.2115 + }
1.2116 +
1.2117 + INFO_PRINTF1(_L("StopHistogram for histogram for Image Capture"));
1.2118 + histogram_IC->StopHistogram();
1.2119 +
1.2120 + //start snapshot for image capture
1.2121 + INFO_PRINTF1(_L("EnableSnapshotL for snapshot for Image Capture"));
1.2122 + TRAP(err,snapshot_IC->EnableSnapshotL());
1.2123 + if(err != KErrNone)
1.2124 + {
1.2125 + INFO_PRINTF1(_L("EnableSnapshotL for snapshot for Image Capture: unexpected result!"));
1.2126 + result = EFail;
1.2127 + }
1.2128 + camImgCapture = NULL;
1.2129 + camImgCapture = 0;
1.2130 + CheckCaptureNotification(camImgCapture, postCaptCtrlId, result);
1.2131 + if(camImgCapture == NULL || postCaptCtrlId != postCaptureControlId)
1.2132 + {
1.2133 + INFO_PRINTF1(_L("EnableSnapshotL for snapshot for Image Capture unexpected!"));
1.2134 + result = EFail;
1.2135 + }
1.2136 +
1.2137 + //start histogram for snapshot for image capture
1.2138 + INFO_PRINTF1(_L("StartHistogram for snapshot for Image Capture"));
1.2139 + histogram_snapshot_IC->StartHistogram();
1.2140 + camImgCapture=NULL;
1.2141 + postCaptCtrlId = 0;
1.2142 + CheckCaptureNotification(camImgCapture, postCaptCtrlId, result);
1.2143 + if(camImgCapture == NULL || postCaptCtrlId != postCaptureControlId)
1.2144 + {
1.2145 + INFO_PRINTF1(_L("StartHistogram for Histogram for snapshot for Image Capture unexpected!"));
1.2146 + result = EFail;
1.2147 + }
1.2148 +
1.2149 + INFO_PRINTF1(_L("StopHistogram for histogram for snapshot for Image Capture"));
1.2150 + histogram_snapshot_IC->StopHistogram();
1.2151 + //
1.2152 +
1.2153 + INFO_PRINTF1(_L("DisableSnapshotL for snapshot for Image Capture"));
1.2154 + TRAP(err,snapshot_IC->DisableSnapshotL());
1.2155 + if(err != KErrNone)
1.2156 + {
1.2157 + INFO_PRINTF1(_L("DisableSnapshotL for snapshot for Image Capture: unexpected result!"));
1.2158 + result = EFail;
1.2159 + }
1.2160 +
1.2161 + CleanupStack::PopAndDestroy(postImgCapt);
1.2162 + CleanupStack::PopAndDestroy(histogram_snapshot_IC);
1.2163 + CleanupStack::PopAndDestroy(snapshot_IC);
1.2164 + CleanupStack::PopAndDestroy(impProc);
1.2165 + CleanupStack::PopAndDestroy(histogram_IC);
1.2166 + CleanupStack::PopAndDestroy(imageCapture);
1.2167 + }
1.2168 + CleanupStack::PopAndDestroy(preImgCapture);
1.2169 + }
1.2170 + else
1.2171 + {
1.2172 + INFO_PRINTF1(_L("CCameraPreImageCaptureControl object was not created using NewL"));
1.2173 + result = EFail;
1.2174 + }
1.2175 + CleanupStack::PopAndDestroy(camera);
1.2176 + }
1.2177 + else
1.2178 + {
1.2179 + INFO_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
1.2180 + result = EFail;
1.2181 + }
1.2182 + __MM_HEAP_MARKEND;
1.2183 +
1.2184 + return result;
1.2185 + }
1.2186 +
1.2187 +/*------------------------------------------------------
1.2188 + Video Capture Control : RECamVideoCaptureControlTest
1.2189 + *------------------------------------------------------*/
1.2190 +RECamVideoCaptureControlTest* RECamVideoCaptureControlTest::NewL(const TDesC& aTestStep)
1.2191 + {
1.2192 + RECamVideoCaptureControlTest* self = new (ELeave) RECamVideoCaptureControlTest(aTestStep);
1.2193 + return self;
1.2194 + }
1.2195 +
1.2196 +RECamVideoCaptureControlTest::RECamVideoCaptureControlTest(const TDesC& aTestStep)
1.2197 + {
1.2198 + iTestStepName.Copy(aTestStep);
1.2199 + }
1.2200 +
1.2201 +TVerdict RECamVideoCaptureControlTest::DoTestStepL()
1.2202 + {
1.2203 + if(!iTestStepName.Compare(_L("MM-ECM-ADV-U-056-HP")))
1.2204 + {
1.2205 + return DoTestStep_56L();
1.2206 + }
1.2207 + return EInconclusive;
1.2208 + }
1.2209 +
1.2210 +TVerdict RECamVideoCaptureControlTest::DoTestStep_56L()
1.2211 + {
1.2212 + TVerdict verdict = EFail;
1.2213 + INFO_PRINTF1(_L("Alloc test"));
1.2214 + TInt i;
1.2215 + TInt err;
1.2216 + for (i = 1 ; ; i++)
1.2217 + {
1.2218 + __MM_HEAP_MARK;
1.2219 +
1.2220 + if (i % 5 == 0)
1.2221 + {
1.2222 + INFO_PRINTF2(_L("Fail count = %d"), i);
1.2223 + }
1.2224 +
1.2225 + __UHEAP_SETFAIL(RHeap::EFailNext, i);
1.2226 +
1.2227 + TRAP(err, verdict = DoVideoCaptureTestStepL());
1.2228 +
1.2229 + TAny* testAlloc = User::Alloc(1);
1.2230 + TBool heapTestingComplete = (testAlloc == NULL) && (err==KErrNone);
1.2231 + User::Free(testAlloc);
1.2232 +
1.2233 + __UHEAP_RESET;
1.2234 + __MM_HEAP_MARKEND;
1.2235 +
1.2236 + if ((err != KErrNoMemory ) || heapTestingComplete)
1.2237 + {
1.2238 + INFO_PRINTF4(_L("err = %d, verdict = %d, Fail count = %d"), err, verdict, i);
1.2239 + INFO_PRINTF1(_L("Alloc testing completed successfully"));
1.2240 + verdict = EPass;
1.2241 + break;
1.2242 + }
1.2243 + }
1.2244 + return verdict;
1.2245 + }
1.2246 +
1.2247 +TVerdict RECamVideoCaptureControlTest::DoVideoCaptureTestStepL()
1.2248 + {
1.2249 + TVerdict result = EPass;
1.2250 + CCamera* camera = NULL;
1.2251 +
1.2252 + MCaptureVideoObserver* videoCaptureObserver = NULL;
1.2253 +
1.2254 + TInt error = KErrNone;
1.2255 + CCamera::CCameraVideoCaptureControl* videoCapture = NULL;
1.2256 +
1.2257 + // using observer
1.2258 + __MM_HEAP_MARK;
1.2259 + MCameraObserver* observer=NULL;
1.2260 + INFO_PRINTF1(_L("Create camera using Camera::NewL() and MCameraObserver"));
1.2261 + TRAP(error, camera = CCamera::NewL(*observer, 0));
1.2262 + if (error==KErrNone)
1.2263 + {
1.2264 + CleanupStack::PushL(camera);
1.2265 + INFO_PRINTF1(_L("Create VideoCaptureControl from CCamera object"));
1.2266 +
1.2267 + TRAP(error, videoCapture = CCamera::CCameraVideoCaptureControl::NewL(*camera, *videoCaptureObserver));
1.2268 + if (error==KErrExtensionNotSupported)
1.2269 + {
1.2270 + INFO_PRINTF1(_L("CCameraVideoCaptureControl object creation using old Observer failed with correct error"));
1.2271 + }
1.2272 + else
1.2273 + {
1.2274 + INFO_PRINTF1(_L("CCameraVideoCaptureControl object creation using old Observer gave unexpected result"));
1.2275 + result = EFail;
1.2276 + }
1.2277 + CleanupStack::PopAndDestroy(camera);
1.2278 + }
1.2279 + else
1.2280 + {
1.2281 + INFO_PRINTF2(_L("Unexpected %d return from CCamera::NewL()"), error);
1.2282 + result = EFail;
1.2283 + User::Leave(KErrNoMemory);
1.2284 + }
1.2285 + __MM_HEAP_MARKEND;
1.2286 +
1.2287 + // using observer2 with NewL
1.2288 + MCameraObserver2* observer2 = NULL;
1.2289 + __MM_HEAP_MARK;
1.2290 + INFO_PRINTF1(_L("Create camera using Camera::NewL() and MCameraObserver2"));
1.2291 + TRAP(error, camera = CCamera::NewL(*observer2, 0,0));
1.2292 + if (error==KErrNone)
1.2293 + {
1.2294 + CleanupStack::PushL(camera);
1.2295 + INFO_PRINTF1(_L("Create VideoCaptureControl from CCamera object"));
1.2296 +
1.2297 + TRAP(error, videoCapture = CCamera::CCameraVideoCaptureControl::NewL(*camera, *videoCaptureObserver));
1.2298 + if (error==KErrExtensionNotSupported)
1.2299 + {
1.2300 + INFO_PRINTF1(_L("CCameraVideoCaptureControl object creation using Observer2 with NewL failed with correct error"));
1.2301 + }
1.2302 + else
1.2303 + {
1.2304 + INFO_PRINTF1(_L("CCameraVideoCaptureControl object creation using Observer2 with NewL gave unexpected result"));
1.2305 + result = EFail;
1.2306 + }
1.2307 + CleanupStack::PopAndDestroy(camera);
1.2308 + }
1.2309 + else
1.2310 + {
1.2311 + INFO_PRINTF2(_L("Unexpected %d return from CCamera::NewL()"), error);
1.2312 + result = EFail;
1.2313 + User::Leave(KErrNoMemory);
1.2314 + }
1.2315 + __MM_HEAP_MARKEND;
1.2316 +
1.2317 +
1.2318 + // create video capture control object using New2L
1.2319 + __MM_HEAP_MARK;
1.2320 + INFO_PRINTF1(_L("Create camera using Camera::New2L() and MCameraObserver2"));
1.2321 +
1.2322 + TRAP(error, camera = CCamera::New2L(*observer2, 0,0));
1.2323 + if (error==KErrNone)
1.2324 + {
1.2325 + CleanupStack::PushL(camera);
1.2326 + INFO_PRINTF1(_L("KErrNone return from CCamera::New2L()"));
1.2327 + TRAP(error, videoCapture = CCamera::CCameraVideoCaptureControl::NewL(*camera, *videoCaptureObserver));
1.2328 +
1.2329 + if (error==KErrNone)
1.2330 + {
1.2331 + CleanupStack::PushL(videoCapture);
1.2332 + INFO_PRINTF1(_L("CCameraVideoCaptureControl object was created using NewL"));
1.2333 + CleanupStack::PopAndDestroy(videoCapture);
1.2334 + }
1.2335 + else
1.2336 + {
1.2337 + INFO_PRINTF1(_L("CCameraVideoCaptureControl object was not created using NewL"));
1.2338 + result = EFail;
1.2339 + User::Leave(KErrNoMemory);
1.2340 + }
1.2341 + CleanupStack::PopAndDestroy(camera);
1.2342 + }
1.2343 + else
1.2344 + {
1.2345 + INFO_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
1.2346 + result = EFail;
1.2347 + User::Leave(KErrNoMemory);
1.2348 + }
1.2349 + __MM_HEAP_MARKEND;
1.2350 +
1.2351 + return result;
1.2352 + }
1.2353 +
1.2354 +/*--------------------------------------------------------------
1.2355 + Video Capture Control : RECamVideoCaptureNotificationTest
1.2356 + *--------------------------------------------------------------*/
1.2357 +RECamVideoCaptureNotificationTest* RECamVideoCaptureNotificationTest::NewL(TBool aAllocTest)
1.2358 + {
1.2359 + RECamVideoCaptureNotificationTest* self = new (ELeave) RECamVideoCaptureNotificationTest(aAllocTest);
1.2360 + CleanupStack::PushL(self);
1.2361 + self->ConstructL();
1.2362 + CleanupStack::Pop(self);
1.2363 + return self;
1.2364 + }
1.2365 +
1.2366 +void RECamVideoCaptureNotificationTest::ConstructL()
1.2367 + {
1.2368 + }
1.2369 +
1.2370 +RECamVideoCaptureNotificationTest::RECamVideoCaptureNotificationTest(TBool /*aAllocTest*/)
1.2371 + {
1.2372 + iTestStepName = _L("MM-ECM-ADV-U-057-HP");
1.2373 + }
1.2374 +
1.2375 +void RECamVideoCaptureNotificationTest::VideoBufferReady(MCameraBuffer2* /*aVideoBuffer*/, TInt aErrorCode)
1.2376 + {
1.2377 + iError = aErrorCode;
1.2378 + }
1.2379 +
1.2380 +void RECamVideoCaptureNotificationTest::ClientSnapshotReady(MCameraBuffer2* /*aSnapshotBuffer*/, TInt aErrorCode)
1.2381 + {
1.2382 + iError = aErrorCode;
1.2383 + }
1.2384 +
1.2385 +void RECamVideoCaptureNotificationTest::ClientHistogramReady(MHistogramV2Buffer* /*aClientHistogramBuffer*/, TInt aErrorCode)
1.2386 + {
1.2387 + iError = aErrorCode;
1.2388 + }
1.2389 +
1.2390 +void RECamVideoCaptureNotificationTest::ImageProcessingFailed(TInt aErrorCode)
1.2391 + {
1.2392 + iError = aErrorCode;
1.2393 + }
1.2394 +
1.2395 +void RECamVideoCaptureNotificationTest::DirectVideoCaptureFailed(TInt aErrorCode)
1.2396 + {
1.2397 + iError = aErrorCode;
1.2398 + }
1.2399 +
1.2400 +TInt RECamVideoCaptureNotificationTest::CustomInterface(TUid /*aInterface*/, TAny*& /*aPtrInterface*/)
1.2401 + {
1.2402 + return KErrNone;
1.2403 + }
1.2404 +
1.2405 +void RECamVideoCaptureNotificationTest::CheckVideoCaptureNegNotification(TInt aErrorCode, TVerdict& aResult)
1.2406 + {
1.2407 + INFO_PRINTF3(_L("Expected Video Capture Control Error %d, received Error %d."), aErrorCode, iError);
1.2408 + if (iError != aErrorCode)
1.2409 + {
1.2410 + aResult = EFail;
1.2411 + }
1.2412 + }
1.2413 +
1.2414 +TVerdict RECamVideoCaptureNotificationTest::DoTestStepL()
1.2415 + {
1.2416 + TVerdict result = EPass;
1.2417 + CCamera* camera = NULL;
1.2418 +
1.2419 + TInt error = KErrNone;
1.2420 + CCamera::CCameraVideoCaptureControl* videocapture = NULL;
1.2421 +
1.2422 + // create video capture control object using New2L
1.2423 + __MM_HEAP_MARK;
1.2424 + INFO_PRINTF1(_L("Create camera using Camera::New2L() and MCameraObserver2"));
1.2425 +
1.2426 + TRAP(error, camera = CCamera::New2L(*this, 0, 0));
1.2427 +
1.2428 + if (error==KErrNone)
1.2429 + {
1.2430 + CleanupStack::PushL(camera);
1.2431 + INFO_PRINTF1(_L("KErrNone return from CCamera::New2L()"));
1.2432 + TRAP(error, videocapture = CCamera::CCameraVideoCaptureControl::NewL(*camera, *this));
1.2433 +
1.2434 + if (error==KErrNone)
1.2435 + {
1.2436 + CleanupStack::PushL(videocapture);
1.2437 + INFO_PRINTF1(_L("CCameraVideoCaptureControl object was created using NewL"));
1.2438 + //Test Video Capture APIs
1.2439 + INFO_PRINTF1(_L("Create Histogram for Direct ViewFinder"));
1.2440 + CCamera::CCameraV2Histogram* histogram_VC = videocapture->CreateHistogramHandleL();
1.2441 + if(!histogram_VC)
1.2442 + {
1.2443 + INFO_PRINTF1(_L("Histogram creation for Video Capture Control unsuccessful"));
1.2444 + result = EFail;
1.2445 + }
1.2446 +
1.2447 + CleanupStack::PushL(histogram_VC);
1.2448 +
1.2449 + INFO_PRINTF1(_L("Create ImageProcessing for Video Capture Control "));
1.2450 +
1.2451 + TRAPD(err, videocapture->GetTransformationHandleL());
1.2452 + if(err != KErrNotSupported)
1.2453 + {
1.2454 + INFO_PRINTF1(_L("ImageProcessing creation for Video Capture Control : unexpected result!"));
1.2455 + result = EFail;
1.2456 + }
1.2457 +
1.2458 + INFO_PRINTF1(_L("Create snapshot for Video Capture Control "));
1.2459 + TInt viewfinderID=0;
1.2460 + CCamera::CCameraSnapshot* snapshot_VC = videocapture->GetSnapshotHandleL(viewfinderID);
1.2461 + if(!snapshot_VC)
1.2462 + {
1.2463 + INFO_PRINTF1(_L("snapshot creation for Video Capture Control : unexpected result!"));
1.2464 + result = EFail;
1.2465 + }
1.2466 +
1.2467 + CleanupStack::PushL(snapshot_VC);
1.2468 +
1.2469 + //set properties for video capture
1.2470 + INFO_PRINTF1(_L("GetVideoFormatsSupportedL for Video Capture Control"));
1.2471 + TUint videoFormatsSupported=0;
1.2472 + TSize size(320,240);
1.2473 + TRAP(err,videocapture->GetVideoFormatsSupportedL(videoFormatsSupported, size));
1.2474 + if(err != KErrNone)
1.2475 + {
1.2476 + INFO_PRINTF1(_L("GetVideoFormatsSupportedL for Video Capture Control: unexpected result!"));
1.2477 + result = EFail;
1.2478 + }
1.2479 +
1.2480 + if(videoFormatsSupported == 0)
1.2481 + {
1.2482 + INFO_PRINTF1(_L(" Number of VideoFormats Supported for Video Capture Control: unexpected result!"));
1.2483 + }
1.2484 +
1.2485 + INFO_PRINTF1(_L("GetPixelAspectsSupportedL for Video Capture Control"));
1.2486 + TUint pixelAspectsSupported=0;
1.2487 + CCamera::TFormat format = CCamera::EFormatFbsBitmapColor16M;
1.2488 + TRAP(err,videocapture->GetPixelAspectsSupportedL(pixelAspectsSupported, format, size));
1.2489 + if(err != KErrNone)
1.2490 + {
1.2491 + INFO_PRINTF1(_L("GetPixelAspectsSupportedL for Video Capture Control: unexpected result!"));
1.2492 + result = EFail;
1.2493 + }
1.2494 +
1.2495 + if(pixelAspectsSupported == 0)
1.2496 + {
1.2497 + INFO_PRINTF1(_L(" Number of PixelAspects Supported for Video Capture Control: unexpected result!"));
1.2498 + }
1.2499 +
1.2500 + INFO_PRINTF1(_L("GetEmbeddedStillCaptureSupportInfoL for Video Capture Control"));
1.2501 + TInt supportedEmbeddedStillCaptureTypes=0;
1.2502 + TRAP(err,videocapture->GetEmbeddedStillCaptureSupportInfoL(supportedEmbeddedStillCaptureTypes));
1.2503 + if(err != KErrNone)
1.2504 + {
1.2505 + INFO_PRINTF1(_L("GetEmbeddedStillCaptureSupportInfoL for Video Capture Control: unexpected result!"));
1.2506 + result = EFail;
1.2507 + }
1.2508 +
1.2509 + if(supportedEmbeddedStillCaptureTypes != 0)
1.2510 + {
1.2511 + INFO_PRINTF1(_L(" Supported Types of Embedded Still Capture for Video Capture Control: unexpected result!"));
1.2512 + }
1.2513 +
1.2514 + INFO_PRINTF1(_L("PrepareVideoCapture for Video Capture Control"));
1.2515 + iInputEventUid = KUidECamEventVideoCaptureControlPrepareComplete;
1.2516 + CCamera::CCameraVideoCaptureControl::TPrepareVideoParameters prepareVideoParameters;
1.2517 +
1.2518 + prepareVideoParameters.SetEmbeddedStillCaptureState(ETrue);
1.2519 +
1.2520 + if(!prepareVideoParameters.IsEmbeddedStillCaptureEnabled())
1.2521 + {
1.2522 + INFO_PRINTF1(_L("IsEmbeddedStillCaptureEnabled for Video Capture Control: unexpected result!"));
1.2523 + result = EFail;
1.2524 + }
1.2525 +
1.2526 + prepareVideoParameters.SetEmbeddedStillCaptureState(EFalse);
1.2527 +
1.2528 + if(prepareVideoParameters.IsEmbeddedStillCaptureEnabled() != EFalse)
1.2529 + {
1.2530 + INFO_PRINTF1(_L("IsEmbeddedStillCaptureEnabled for Video Capture Control: unexpected result!"));
1.2531 + result = EFail;
1.2532 + }
1.2533 +
1.2534 + videocapture->PrepareVideoCapture(prepareVideoParameters);
1.2535 +
1.2536 + CheckNotification(iInputEventUid, result);
1.2537 +
1.2538 + INFO_PRINTF1(_L("GetRangeAffectedSettingsL for Video Capture Control"));
1.2539 + RArray<TUid> affectedSettings;
1.2540 +
1.2541 + TRAP(err,videocapture->GetRangeAffectedSettingsL(affectedSettings));
1.2542 + if(err != KErrNone)
1.2543 + {
1.2544 + INFO_PRINTF1(_L("GetRangeAffectedSettingsL for Video Capture Control: unexpected result!"));
1.2545 + result = EFail;
1.2546 + }
1.2547 +
1.2548 + if(affectedSettings.Count() != 0)
1.2549 + {
1.2550 + INFO_PRINTF1(_L("Number of RangeAffectedSettingsL for Video Capture Control: unexpected result!"));
1.2551 + result = EFail;
1.2552 + }
1.2553 +
1.2554 + INFO_PRINTF1(_L("GetValueAffectedSettingsL for Video Capture Control"));
1.2555 + TRAP(err,videocapture->GetValueAffectedSettingsL(affectedSettings));
1.2556 + if(err != KErrNone)
1.2557 + {
1.2558 + INFO_PRINTF1(_L("GetValueAffectedSettingsL for Video Capture Control: unexpected result!"));
1.2559 + result = EFail;
1.2560 + }
1.2561 +
1.2562 + if(affectedSettings.Count() != 0)
1.2563 + {
1.2564 + INFO_PRINTF1(_L("Number of ValueAffectedSettingsL for Video Capture Control: unexpected result!"));
1.2565 + result = EFail;
1.2566 + }
1.2567 +
1.2568 + INFO_PRINTF1(_L("GetDisabledSettingsL for Video Capture Control"));
1.2569 + TRAP(err,videocapture->GetDisabledSettingsL(affectedSettings));
1.2570 + if(err != KErrNone)
1.2571 + {
1.2572 + INFO_PRINTF1(_L("GetDisabledSettingsL for Video Capture Control: unexpected result!"));
1.2573 + result = EFail;
1.2574 + }
1.2575 +
1.2576 + if(affectedSettings.Count() != 0)
1.2577 + {
1.2578 + INFO_PRINTF1(_L("Number of DisabledSettingsL for Video Capture Control: unexpected result!"));
1.2579 + result = EFail;
1.2580 + }
1.2581 +
1.2582 + INFO_PRINTF1(_L("ReleaseVideoResource for Video Capture Control"));
1.2583 + videocapture->ReleaseVideoResource();
1.2584 +
1.2585 + INFO_PRINTF1(_L("GetFadingEffectStateL for Video Capture Control"));
1.2586 + CCamera::CCameraVideoCaptureControl::TFadingEffectState fadingEffectState =
1.2587 + CCamera::CCameraVideoCaptureControl::EFadingEffectDisabled;
1.2588 + TRAP(err,videocapture->GetFadingEffectStateL(fadingEffectState));
1.2589 + if(err != KErrNotSupported)
1.2590 + {
1.2591 + INFO_PRINTF1(_L("GetFadingEffectStateL for Video Capture Control: unexpected result!"));
1.2592 + result = EFail;
1.2593 + }
1.2594 +
1.2595 + INFO_PRINTF1(_L("SetFadingEffectState for Video Capture Control"));
1.2596 + iInputEventUid = KUidECamEventVideoCaptureControlFadingEffect;
1.2597 + videocapture->SetFadingEffectState(CCamera::CCameraVideoCaptureControl::EFadingEffectEnabled);
1.2598 + CheckNotificationNeg(iInputEventUid, result);
1.2599 +
1.2600 + //set properties for histogram (for video capture)
1.2601 + TUint supportedHistogramType=0;
1.2602 + histogram_VC->GetSupportedHistogramsL(supportedHistogramType);
1.2603 + if(supportedHistogramType!=0)
1.2604 + {
1.2605 + INFO_PRINTF1(_L("unexpected GetSupportedHistogramsL"));
1.2606 + result = EFail;
1.2607 + }
1.2608 +
1.2609 + INFO_PRINTF1(_L("GetDirectHistogramSupportInfoL for Histogram for Video Capture"));
1.2610 + TBool directHistogramSupported = EFalse;
1.2611 + TRAP(err,histogram_VC->GetDirectHistogramSupportInfoL(directHistogramSupported));
1.2612 + if(err != KErrNotSupported)
1.2613 + {
1.2614 + INFO_PRINTF1(_L("GetDirectHistogramSupportInfoL for Histogram for Video Capture: unexpected result!"));
1.2615 + result = EFail;
1.2616 + }
1.2617 +
1.2618 + INFO_PRINTF1(_L("PrepareClientHistogramL for Histogram for Video Capture"));
1.2619 + CCamera::CCameraV2Histogram::THistogramType histogramType = CCamera::CCameraV2Histogram::EHistNone;
1.2620 + TRAP(err,histogram_VC->PrepareClientHistogramL(histogramType));
1.2621 + if(err != KErrNotSupported)
1.2622 + {
1.2623 + INFO_PRINTF1(_L("PrepareClientHistogramL for Histogram for Video Capture: unexpected result!"));
1.2624 + result = EFail;
1.2625 + }
1.2626 +
1.2627 + INFO_PRINTF1(_L("PrepareDirectHistogramL for Histogram for Video Capture"));
1.2628 + CCamera::CCameraV2Histogram::TDirectHistogramParameters histogramParameters;
1.2629 + TRAP(err,histogram_VC->PrepareDirectHistogramL(histogramParameters));
1.2630 + if(err != KErrNotSupported)
1.2631 + {
1.2632 + INFO_PRINTF1(_L("PrepareDirectHistogramL for Histogram for Video Capture: unexpected result!"));
1.2633 + result = EFail;
1.2634 + }
1.2635 +
1.2636 + INFO_PRINTF1(_L("UpdateDirectHistogramPropertiesL for Histogram for Video Capture"));
1.2637 + TRAP(err,histogram_VC->UpdateDirectHistogramPropertiesL(histogramParameters));
1.2638 + if(err != KErrNotSupported)
1.2639 + {
1.2640 + INFO_PRINTF1(_L("UpdateDirectHistogramPropertiesL for Histogram for Video Capture: unexpected result!"));
1.2641 + result = EFail;
1.2642 + }
1.2643 +
1.2644 + INFO_PRINTF1(_L("GetDirectHistogramPropertiesL for Histogram for Video Capture"));
1.2645 + TRAP(err,histogram_VC->GetDirectHistogramPropertiesL(histogramParameters));
1.2646 + if(err != KErrNotSupported)
1.2647 + {
1.2648 + INFO_PRINTF1(_L("GetDirectHistogramPropertiesL for Histogram for Video Capture: unexpected result!"));
1.2649 + result = EFail;
1.2650 + }
1.2651 +
1.2652 + INFO_PRINTF1(_L("GetHistogramStateL for Histogram for Video Capture"));
1.2653 + TBool histogramActive = EFalse;
1.2654 + TRAP(err,histogram_VC->GetHistogramStateL(histogramActive));
1.2655 + if(err != KErrNotSupported)
1.2656 + {
1.2657 + INFO_PRINTF1(_L("GetHistogramStateL for Histogram for Video Capture: unexpected result!"));
1.2658 + result = EFail;
1.2659 + }
1.2660 +
1.2661 + //set properties for snapshot (for video capture)
1.2662 + CCamera::CCameraSnapshot::TSnapshotParameters snapshotParam;
1.2663 +
1.2664 + INFO_PRINTF1(_L("SetAspectRatioState for Snapshot for Video Capture"));
1.2665 + snapshotParam.SetAspectRatioState(ETrue);
1.2666 + TBool aspectRatioState = snapshotParam.IsAspectRatioMaintained();
1.2667 + if(!aspectRatioState)
1.2668 + {
1.2669 + INFO_PRINTF1(_L("AspectRatioState for Snapshot for Video Capture: unexpected result!"));
1.2670 + result = EFail;
1.2671 + }
1.2672 + snapshotParam.SetAspectRatioState(EFalse);
1.2673 + aspectRatioState = snapshotParam.IsAspectRatioMaintained();
1.2674 + if(aspectRatioState != EFalse)
1.2675 + {
1.2676 + INFO_PRINTF1(_L("AspectRatioState for Snapshot for Video Capture: unexpected result!"));
1.2677 + result = EFail;
1.2678 + }
1.2679 +
1.2680 + INFO_PRINTF1(_L("PrepareSnapshotL for Snapshot for Video Capture"));
1.2681 + TRAP(err,snapshot_VC->PrepareSnapshotL(snapshotParam));
1.2682 + if(err != KErrNone)
1.2683 + {
1.2684 + INFO_PRINTF1(_L("PrepareSnapshotL for Snapshot for Video Capture: unexpected result!"));
1.2685 + result = EFail;
1.2686 + }
1.2687 +
1.2688 + INFO_PRINTF1(_L("GetSnapshotParametersL for Snapshot for Video Capture"));
1.2689 + TRAP(err,snapshot_VC->GetSnapshotParametersL(snapshotParam));
1.2690 + if(err != KErrNone)
1.2691 + {
1.2692 + INFO_PRINTF1(_L("GetSnapshotParametersL for Snapshot for Video Capture: unexpected result!"));
1.2693 + result = EFail;
1.2694 + }
1.2695 +
1.2696 + INFO_PRINTF1(_L("SetSnapshotParametersL for Snapshot for Video Capture"));
1.2697 + TRAP(err,snapshot_VC->SetSnapshotParametersL(snapshotParam));
1.2698 + if(err != KErrNone)
1.2699 + {
1.2700 + INFO_PRINTF1(_L("SetSnapshotParametersL for Snapshot for Video Capture: unexpected result!"));
1.2701 + result = EFail;
1.2702 + }
1.2703 +
1.2704 + INFO_PRINTF1(_L("SelectSnapshotVideoFramesL for Snapshot for Video Capture"));
1.2705 + CCamera::CCameraSnapshot::TSnapshotVideoFrames snapshotVideoFrames = CCamera::CCameraSnapshot::ESnapshotVideoFirstFrame;
1.2706 + TRAP(err,snapshot_VC->SelectSnapshotVideoFramesL(snapshotVideoFrames));
1.2707 + if(err != KErrNotSupported)
1.2708 + {
1.2709 + INFO_PRINTF1(_L("SelectSnapshotVideoFramesL for Snapshot for Video Capture: unexpected result!"));
1.2710 + result = EFail;
1.2711 + }
1.2712 +
1.2713 + //Start video capture and other child objects
1.2714 + INFO_PRINTF1(_L("StartVideoCaptureL for Video Capture"));
1.2715 + TRAP(err,videocapture->StartVideoCaptureL());
1.2716 + if(err != KErrNone)
1.2717 + {
1.2718 + INFO_PRINTF1(_L("StartVideoCaptureL for Video Capture: unexpected result!"));
1.2719 + result = EFail;
1.2720 + }
1.2721 +
1.2722 + CheckVideoCaptureNegNotification(KErrNotSupported, result);
1.2723 +
1.2724 + INFO_PRINTF1(_L("StartHistogram for Video Capture"));
1.2725 + histogram_VC->StartHistogram();
1.2726 + CheckVideoCaptureNegNotification(KErrNotSupported, result);
1.2727 +
1.2728 + INFO_PRINTF1(_L("StopHistogram for Video Capture"));
1.2729 + histogram_VC->StopHistogram();
1.2730 +
1.2731 + INFO_PRINTF1(_L("EnableSnapshotL for snapshot for Video Capture"));
1.2732 + TRAP(err,snapshot_VC->EnableSnapshotL());
1.2733 + if(err != KErrNone)
1.2734 + {
1.2735 + INFO_PRINTF1(_L("EnableSnapshotL for snapshot for Video Capture: unexpected result!"));
1.2736 + result = EFail;
1.2737 + }
1.2738 + CheckVideoCaptureNegNotification(KErrNotSupported, result);
1.2739 +
1.2740 + INFO_PRINTF1(_L("GetSnapshotStatusL for snapshot for Video Capture"));
1.2741 + CCamera::CCameraSnapshot::TSnapshotState snapshotState = CCamera::CCameraSnapshot::ESnapshotInactive;
1.2742 + TRAP(err,snapshot_VC->GetSnapshotStatusL(snapshotState));
1.2743 + if(err != KErrNotSupported)
1.2744 + {
1.2745 + INFO_PRINTF1(_L("GetSnapshotStatusL for snapshot for Video Capture: unexpected result!"));
1.2746 + result = EFail;
1.2747 + }
1.2748 +
1.2749 + INFO_PRINTF1(_L("DisableSnapshotL for snapshot for Video Capture"));
1.2750 + TRAP(err,snapshot_VC->DisableSnapshotL());
1.2751 + if(err != KErrNone)
1.2752 + {
1.2753 + INFO_PRINTF1(_L("DisableSnapshotL for snapshot for Video Capture: unexpected result!"));
1.2754 + result = EFail;
1.2755 + }
1.2756 +
1.2757 + INFO_PRINTF1(_L("PauseVideoCapture for Video Capture"));
1.2758 + videocapture->PauseVideoCapture();
1.2759 +
1.2760 + INFO_PRINTF1(_L("ResumeVideoCaptureL for Video Capture"));
1.2761 + TRAP(err,videocapture->ResumeVideoCaptureL());
1.2762 + if(err != KErrNotSupported)
1.2763 + {
1.2764 + INFO_PRINTF1(_L("ResumeVideoCaptureL for Video Capture: unexpected result!"));
1.2765 + result = EFail;
1.2766 + }
1.2767 +
1.2768 + INFO_PRINTF1(_L("GetVideoCaptureStateL for Video Capture"));
1.2769 + CCamera::CCameraVideoCaptureControl::TVideoCaptureState videoCaptureState =
1.2770 + CCamera::CCameraVideoCaptureControl::EVideoCaptureInActive;
1.2771 + TRAP(err,videocapture->GetVideoCaptureStateL(videoCaptureState));
1.2772 + if(err != KErrNotSupported)
1.2773 + {
1.2774 + INFO_PRINTF1(_L("GetVideoCaptureStateL for Video Capture: unexpected result!"));
1.2775 + result = EFail;
1.2776 + }
1.2777 +
1.2778 + INFO_PRINTF1(_L("StopVideoCapture for Video Capture"));
1.2779 + videocapture->StopVideoCapture();
1.2780 +
1.2781 + //Start Direct video capture and other child objects
1.2782 + TInt supportedDVCType = -1;
1.2783 + INFO_PRINTF1(_L("Check Direct Video Capture Support Info"));
1.2784 + TRAP(err,videocapture->GetVideoCaptureSupportInfoL(supportedDVCType));
1.2785 + if(err != KErrNone)
1.2786 + {
1.2787 + INFO_PRINTF1(_L("GetVideoCaptureSupportInfoL for Video Capture: unexpected result!"));
1.2788 + result = EFail;
1.2789 + }
1.2790 +
1.2791 + if(supportedDVCType != KSupportedDirectVCType)
1.2792 + {
1.2793 + INFO_PRINTF1(_L("GetVideoCaptureSupportInfoL for Video Capture: unexpected result!"));
1.2794 + result = EFail;
1.2795 + }
1.2796 +
1.2797 + INFO_PRINTF1(_L("Test Set Client Video Capture in PrepareVideoParameters"));
1.2798 +
1.2799 + prepareVideoParameters.SetVideoCaptureType(CCamera::CCameraVideoCaptureControl::EClientVideoCapture);
1.2800 +
1.2801 + if(CCamera::CCameraVideoCaptureControl::EClientVideoCapture != prepareVideoParameters.VideoCaptureType())
1.2802 + {
1.2803 + INFO_PRINTF1(_L("iVideoCaptureType for TPrepareVideoParameters: unexpected result!"));
1.2804 + result = EFail;
1.2805 + }
1.2806 +
1.2807 +
1.2808 + INFO_PRINTF1(_L("Set Video Capture in PrepareVideoParameters"));
1.2809 +
1.2810 + prepareVideoParameters.SetVideoCaptureType(CCamera::CCameraVideoCaptureControl::EDirectVideoCapture);
1.2811 +
1.2812 + if(CCamera::CCameraVideoCaptureControl::EDirectVideoCapture != prepareVideoParameters.VideoCaptureType())
1.2813 + {
1.2814 + INFO_PRINTF1(_L("iVideoCaptureType for TPrepareVideoParameters: unexpected result!"));
1.2815 + result = EFail;
1.2816 + }
1.2817 +
1.2818 + prepareVideoParameters.iFormat = CCamera::EFormatEncodedH264;
1.2819 + prepareVideoParameters.iPixelAspectRatio = CCamera::CCameraAdvancedSettings::EEPixelAspect40To33;
1.2820 +
1.2821 + iInputEventUid = KUidECamEventVideoCaptureControlPrepareComplete;
1.2822 + videocapture->PrepareVideoCapture(prepareVideoParameters);
1.2823 + CheckNotification(iInputEventUid, result);
1.2824 +
1.2825 + INFO_PRINTF1(_L("StartVideoCaptureL for Direct Video Capture"));
1.2826 + TRAP(err,videocapture->StartVideoCaptureL());
1.2827 + if(err != KErrNone)
1.2828 + {
1.2829 + INFO_PRINTF1(_L("StartVideoCaptureL for Video Capture: unexpected result!"));
1.2830 + result = EFail;
1.2831 + }
1.2832 +
1.2833 + CheckVideoCaptureNegNotification(KErrNotSupported, result);
1.2834 +
1.2835 + INFO_PRINTF1(_L("StopVideoCapture for Direct Video Capture"));
1.2836 + videocapture->StopVideoCapture();
1.2837 +
1.2838 + INFO_PRINTF1(_L("GetPrepareVideoParameters for Direct Video Capture"));
1.2839 + CCamera::CCameraVideoCaptureControl::TPrepareVideoParameters retrievedVideoParam;
1.2840 + TRAP(err,videocapture->GetPrepareVideoParametersL(retrievedVideoParam));
1.2841 + if(err != KErrNone)
1.2842 + {
1.2843 + INFO_PRINTF1(_L("GetPrepareVideoParametersL for Video Capture: unexpected result!"));
1.2844 + result = EFail;
1.2845 + }
1.2846 +
1.2847 + if(CCamera::EFormatEncodedH264 != retrievedVideoParam.iFormat)
1.2848 + {
1.2849 + INFO_PRINTF1(_L("GetPrepareVideoParametersL for Video Capture: unexpected result!"));
1.2850 + result = EFail;
1.2851 + }
1.2852 +
1.2853 + INFO_PRINTF2(_L("retrievedVideoParam.iFormat: %d"),retrievedVideoParam.iFormat);
1.2854 + INFO_PRINTF2(_L("retrievedVideoParam.iPixelAspectRatio: %d"),retrievedVideoParam.iPixelAspectRatio);
1.2855 +
1.2856 +
1.2857 + CleanupStack::PopAndDestroy(snapshot_VC);
1.2858 + CleanupStack::PopAndDestroy(histogram_VC);
1.2859 + CleanupStack::PopAndDestroy(videocapture);
1.2860 + }
1.2861 + else
1.2862 + {
1.2863 + INFO_PRINTF1(_L("CCameraVideoCaptureControl object not created"));
1.2864 + result = EFail;
1.2865 + }
1.2866 + CleanupStack::PopAndDestroy(camera);
1.2867 + }
1.2868 + else
1.2869 + {
1.2870 + INFO_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
1.2871 + result = EFail;
1.2872 + }
1.2873 + __MM_HEAP_MARKEND;
1.2874 +
1.2875 + return result;
1.2876 + }