os/mm/imagingandcamerafws/cameraunittest/src/TSU_ECM_ADV/ecamextendedfunctest.cpp
Update contrib.
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #include <ecamuids.hrh>
18 #include <ecom/ecomresolverparams.h>
19 #include "ecamextendedfunctest.h"
20 #include "ECamUnitTestPluginUids.hrh"
21 #include "ECamUnitTestPlugin.h"
22 #include <ecam/ecamcommonuids.hrh>
24 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
25 #include <ecamconst.h>
27 #include <ecamcapturecontrolconst.h>
29 /*------------------------------------------------------
30 Client ViewFinder : RECamClientViewFinderTest
31 *------------------------------------------------------*/
32 RECamClientViewFinderTest* RECamClientViewFinderTest::NewL(const TDesC& aTestStep)
34 RECamClientViewFinderTest* self = new (ELeave) RECamClientViewFinderTest(aTestStep);
38 RECamClientViewFinderTest::RECamClientViewFinderTest(const TDesC& aTestStep)
40 iTestStepName.Copy(aTestStep);
43 TVerdict RECamClientViewFinderTest::DoTestStepL()
45 if(!iTestStepName.Compare(_L("MM-ECM-ADV-U-050-HP")))
47 return DoTestStep_50L();
52 TVerdict RECamClientViewFinderTest::DoTestStep_50L()
54 TVerdict verdict = EFail;
55 INFO_PRINTF1(_L("Alloc test"));
64 INFO_PRINTF2(_L("Fail count = %d"), i);
67 __UHEAP_SETFAIL(RHeap::EFailNext, i);
69 TRAP(err, verdict = DoClientVFTestStepL());
71 TAny* testAlloc = User::Alloc(1);
72 TBool heapTestingComplete = (testAlloc == NULL) && (err==KErrNone);
73 User::Free(testAlloc);
78 if ((err != KErrNoMemory ) || heapTestingComplete)
80 INFO_PRINTF4(_L("err = %d, verdict = %d, Fail count = %d"), err, verdict, i);
81 INFO_PRINTF1(_L("Alloc testing completed successfully"));
89 TVerdict RECamClientViewFinderTest::DoClientVFTestStepL()
91 TVerdict result = EPass;
92 CCamera* camera = NULL;
94 MClientViewFinderObserver *clientVFObserver = NULL;
95 TInt error = KErrNone;
96 CCamera::CCameraClientViewFinder* clientVF = NULL;
98 MCameraObserver* observer = NULL;
102 INFO_PRINTF1(_L("Create camera using Camera::NewL() and MCameraObserver"));
103 TRAP(error, camera = CCamera::NewL(*observer, 0));
106 CleanupStack::PushL(camera);
107 INFO_PRINTF1(_L("Create client viewfinder from CCamera object"));
109 TRAP(error, clientVF = CCamera::CCameraClientViewFinder::NewL(*camera, *clientVFObserver));
110 if (error==KErrExtensionNotSupported)
112 INFO_PRINTF1(_L("CCameraClientViewFinder object creation using old Observer failed with correct error"));
116 INFO_PRINTF1(_L("CCameraClientViewFinder object creation using old Observer gave unexpected result"));
119 CleanupStack::PopAndDestroy(camera);
123 INFO_PRINTF2(_L("Unexpected %d return from CCamera::NewL()"), error);
125 User::Leave(KErrNoMemory);
129 // using observer2 with NewL
130 MCameraObserver2* observer2 = NULL;
132 INFO_PRINTF1(_L("Create camera using Camera::NewL() and MCameraObserver2"));
133 TRAP(error, camera = CCamera::NewL(*observer2, 0,0));
136 CleanupStack::PushL(camera);
137 INFO_PRINTF1(_L("Create client viewfinder from CCamera object"));
139 TRAP(error, clientVF = CCamera::CCameraClientViewFinder::NewL(*camera, *clientVFObserver));
140 if (error==KErrExtensionNotSupported)
142 INFO_PRINTF1(_L("CCameraClientViewFinder object creation using Observer2 with NewL failed with correct error"));
146 INFO_PRINTF1(_L("CCameraClientViewFinder object creation using Observer2 with NewL gave unexpected result"));
149 CleanupStack::PopAndDestroy(camera);
153 INFO_PRINTF2(_L("Unexpected %d return from CCamera::NewL()"), error);
155 User::Leave(KErrNoMemory);
159 // create client viewfinder object using New2L
162 INFO_PRINTF1(_L("Create camera using Camera::New2L() and MCameraObserver2"));
164 TRAP(error, camera = CCamera::New2L(*observer2, 0,0));
167 CleanupStack::PushL(camera);
168 INFO_PRINTF1(_L("KErrNone return from CCamera::New2L()"));
169 TRAP(error, clientVF = CCamera::CCameraClientViewFinder::NewL(*camera, *clientVFObserver));
173 CleanupStack::PushL(clientVF);
174 INFO_PRINTF1(_L("CCameraClientViewFinder object was created using NewL"));
176 INFO_PRINTF1(_L("Create Histogram for Client ViewFinder"));
177 CCamera::CCameraV2Histogram* histogram_CVF = clientVF->CreateHistogramHandleL();
180 INFO_PRINTF1(_L("Histogram creation for Client ViewFinder unsuccessful"));
182 User::Leave(KErrNoMemory);
185 CleanupStack::PushL(histogram_CVF);
186 INFO_PRINTF1(_L("Histogram object was created for Client ViewFinder"));
187 CleanupStack::PopAndDestroy(histogram_CVF);
189 CleanupStack::PopAndDestroy(clientVF);
193 INFO_PRINTF1(_L("CCameraClientViewFinder object was not created using NewL"));
195 User::Leave(KErrNoMemory);
197 CleanupStack::PopAndDestroy(camera);
201 INFO_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
203 User::Leave(KErrNoMemory);
210 /*------------------------------------------------------
211 Client ViewFinder : RECamClientVFNotificationTest
212 *------------------------------------------------------*/
213 RECamClientVFNotificationTest* RECamClientVFNotificationTest::NewL(TBool aAllocTest)
215 RECamClientVFNotificationTest* self = new (ELeave) RECamClientVFNotificationTest(aAllocTest);
216 CleanupStack::PushL(self);
218 CleanupStack::Pop(self);
222 void RECamClientVFNotificationTest::ConstructL()
226 RECamClientVFNotificationTest::RECamClientVFNotificationTest(TBool /*aAllocTest*/)
228 iTestStepName = _L("MM-ECM-ADV-U-051-HP");
231 void RECamClientVFNotificationTest::ViewFinderBufferReady(CCamera::CCameraClientViewFinder& aClientViewFinderHandle, TInt aErrorCode)
233 aClientViewFinderHandle.GetViewFinderHandleL(iVFHandle);
237 void RECamClientVFNotificationTest::DirectHistogramDisplayed(CCamera::CCameraClientViewFinder& aClientViewFinderHandle, CCamera::CCameraV2Histogram& /*aDirectHistogramDisplayed*/, TInt aErrorCode)
239 aClientViewFinderHandle.GetViewFinderHandleL(iVFHandle);
243 void RECamClientVFNotificationTest::ClientHistogramReady(CCamera::CCameraClientViewFinder& aClientViewFinderHandle, MHistogramV2Buffer* /*aClientHistogramBuffer*/, TInt aErrorCode)
245 aClientViewFinderHandle.GetViewFinderHandleL(iVFHandle);
249 void RECamClientVFNotificationTest::ImageProcessingFailed(CCamera::CCameraClientViewFinder& aClientViewFinderHandle, TInt aErrorCode)
251 aClientViewFinderHandle.GetViewFinderHandleL(iVFHandle);
255 TInt RECamClientVFNotificationTest::CustomInterface(TUid /*aInterface*/, TAny*& /*aPtrInterface*/)
260 void RECamClientVFNotificationTest::CheckViewFinderNegNotification(TInt aVFHandle, TVerdict& aResult)
262 INFO_PRINTF4(_L("Expected ClientViewFinder Id %d, received event %x. Error %d."), aVFHandle, iVFHandle, iError);
263 if (aVFHandle != iVFHandle || iError != KErrNotSupported)
269 TVerdict RECamClientVFNotificationTest::DoTestStepL()
271 TVerdict verdict = EFail;
272 INFO_PRINTF1(_L("Alloc test"));
281 INFO_PRINTF2(_L("Fail count = %d"), i);
284 __UHEAP_SETFAIL(RHeap::EFailNext, i);
286 TRAP(err, verdict = DoTestStepL_51L());
288 TAny* testAlloc = User::Alloc(1);
289 TBool heapTestingComplete = (testAlloc == NULL) && (err==KErrNone);
290 User::Free(testAlloc);
295 if ((err != KErrNoMemory && verdict == EPass ) || heapTestingComplete)
297 INFO_PRINTF4(_L("err = %d, verdict = %d, Fail count = %d"), err, verdict, i);
298 INFO_PRINTF1(_L("Alloc testing completed successfully"));
306 TVerdict RECamClientVFNotificationTest::DoTestStepL_51L()
308 TVerdict result = EPass;
309 CCamera* camera = NULL;
311 TInt error = KErrNone;
312 CCamera::CCameraClientViewFinder* clientVF = NULL;
314 /**************************************************************/
315 MCameraObserver2* observer2 = NULL;
317 INFO_PRINTF1(_L("Create camera using Camera::NewL() and MCameraObserver2"));
318 TRAP(error, camera = CCamera::NewL(*observer2, 0,0));
321 CleanupStack::PushL(camera);
322 INFO_PRINTF1(_L("Create client viewfinder from CCamera object"));
324 TRAP(error, clientVF = CCamera::CCameraClientViewFinder::NewL(*camera, *this));
326 if (error == KErrNone)
328 INFO_PRINTF1(_L("CCameraClientViewFinder object creation using Observer2 with NewL is successful."));
330 else if (error==KErrExtensionNotSupported)
332 INFO_PRINTF1(_L("CCameraClientViewFinder object creation using Observer2 with NewL failed with correct error"));
336 INFO_PRINTF1(_L("CCameraClientViewFinder object creation using Observer2 with NewL gave unexpected result"));
339 CleanupStack::PopAndDestroy(camera);
343 INFO_PRINTF2(_L("Unexpected %d return from CCamera::NewL()"), error);
345 User::Leave(KErrNoMemory);
348 /**************************************************************/
350 // create client viewfinder object using New2L
352 INFO_PRINTF1(_L("Create camera using Camera::New2L() and MCameraObserver2"));
354 TRAP(error, camera = CCamera::New2L(*this, 0, 0));
358 CleanupStack::PushL(camera);
359 INFO_PRINTF1(_L("KErrNone return from CCamera::New2L()"));
360 TRAP(error, clientVF = CCamera::CCameraClientViewFinder::NewL(*camera, *this));
364 CleanupStack::PushL(clientVF);
365 INFO_PRINTF1(_L("CCameraClientViewFinder object was created using NewL"));
366 //Test Client ViewFinder APIs
367 INFO_PRINTF1(_L("Create Histogram for Client ViewFinder"));
368 CCamera::CCameraV2Histogram* histogram_CVF = clientVF->CreateHistogramHandleL();
371 INFO_PRINTF1(_L("Histogram creation for Client ViewFinder unsuccessful"));
375 CleanupStack::PushL(histogram_CVF);
377 INFO_PRINTF1(_L("Create ImageProcessing for Client ViewFinder"));
379 TRAPD(err, clientVF->GetTransformationHandleL());
380 if(err != KErrNotSupported)
382 INFO_PRINTF1(_L("ImageProcessing creation for Client ViewFinder: unexpected result!"));
386 //set properties for client VF (base class)
387 INFO_PRINTF1(_L("GetViewFinderFadingCapabilitiesL for Client ViewFinder"));
388 CCameraViewFinder::TViewFinderFadingCapabilities fadingCapabilities;
389 TRAP(err,clientVF->GetViewFinderFadingCapabilitiesL(fadingCapabilities));
390 if(err != KErrNotSupported)
392 INFO_PRINTF1(_L("GetViewFinderFadingCapabilitiesL for Client ViewFinder: unexpected result!"));
396 INFO_PRINTF1(_L("GetViewFinderFadingEffectL for Client ViewFinder"));
397 CCameraViewFinder::TViewFinderFadingEffect fadingEffect;
398 TRAP(err,clientVF->GetViewFinderFadingEffectL(fadingEffect));
399 if(err != KErrNotSupported)
401 INFO_PRINTF1(_L("GetViewFinderFadingEffectL for Client ViewFinder: unexpected result!"));
405 INFO_PRINTF1(_L("SetViewFinderFadingEffectL for Client ViewFinder"));
406 iInputEventUid = KUidECamEvent2ViewFinderFadingEffect;
407 clientVF->SetViewFinderFadingEffectL(fadingEffect);
408 CheckNotificationNeg(iInputEventUid, result);
411 clientVF->GetViewFinderHandleL(vfHandle);
413 //set properties for histogram (for viewfinder)
414 TUint supportedHistogramType=0;
415 histogram_CVF->GetSupportedHistogramsL(supportedHistogramType);
416 if(supportedHistogramType!=0)
418 INFO_PRINTF1(_L("unexpected GetSupportedHistogramsL"));
422 INFO_PRINTF1(_L("GetDirectHistogramSupportInfoL for Histogram for Client ViewFinder"));
423 TBool directHistogramSupported = EFalse;
424 TRAP(err,histogram_CVF->GetDirectHistogramSupportInfoL(directHistogramSupported));
425 if(err != KErrNotSupported)
427 INFO_PRINTF1(_L("GetDirectHistogramSupportInfoL for Histogram for Client ViewFinder: unexpected result!"));
431 INFO_PRINTF1(_L("PrepareClientHistogramL for Histogram for Client ViewFinder"));
432 CCamera::CCameraV2Histogram::THistogramType histogramType = CCamera::CCameraV2Histogram::EHistNone;
433 TRAP(err,histogram_CVF->PrepareClientHistogramL(histogramType));
434 if(err != KErrNotSupported)
436 INFO_PRINTF1(_L("PrepareClientHistogramL for Histogram for Client ViewFinder: unexpected result!"));
440 INFO_PRINTF1(_L("PrepareDirectHistogramL for Histogram for Client ViewFinder"));
441 CCamera::CCameraV2Histogram::TDirectHistogramParameters histogramParameters;
442 TRAP(err,histogram_CVF->PrepareDirectHistogramL(histogramParameters));
443 if(err != KErrNotSupported)
445 INFO_PRINTF1(_L("PrepareDirectHistogramL for Histogram for Client ViewFinder: unexpected result!"));
449 INFO_PRINTF1(_L("UpdateDirectHistogramPropertiesL for Histogram for Client ViewFinder"));
450 TRAP(err,histogram_CVF->UpdateDirectHistogramPropertiesL(histogramParameters));
451 if(err != KErrNotSupported)
453 INFO_PRINTF1(_L("UpdateDirectHistogramPropertiesL for Histogram for Client ViewFinder: unexpected result!"));
457 INFO_PRINTF1(_L("GetDirectHistogramPropertiesL for Histogram for Client ViewFinder"));
458 TRAP(err,histogram_CVF->GetDirectHistogramPropertiesL(histogramParameters));
459 if(err != KErrNotSupported)
461 INFO_PRINTF1(_L("GetDirectHistogramPropertiesL for Histogram for Client ViewFinder: unexpected result!"));
465 INFO_PRINTF1(_L("GetHistogramStateL for Histogram for Client ViewFinder"));
466 TBool histogramActive = EFalse;
467 TRAP(err,histogram_CVF->GetHistogramStateL(histogramActive));
468 if(err != KErrNotSupported)
470 INFO_PRINTF1(_L("GetHistogramStateL for Histogram for Client ViewFinder: unexpected result!"));
474 //viewfinder starting...
475 INFO_PRINTF1(_L("StartClientViewFinderL for Client ViewFinder"));
477 TRAP(err,clientVF->StartClientViewFinderL(0, CCamera::EFormatFbsBitmapColor64K, size));
480 INFO_PRINTF1(_L("StartClientViewFinderL for Client ViewFinder: unexpected result!"));
483 CheckViewFinderNegNotification(vfHandle, result);
485 INFO_PRINTF1(_L("GetViewFinderBufferL for Client ViewFinder"));
486 CFbsBitmap* bitmap = new(ELeave) CFbsBitmap;
487 CleanupStack::PushL(bitmap);
488 RCamBuffer2 cameraVFBuffer(bitmap);
489 TRAP(err,clientVF->GetViewFinderBufferL(cameraVFBuffer));
490 if(err != KErrNotSupported)
492 INFO_PRINTF1(_L("GetViewFinderBufferL for Client ViewFinder: unexpected result!"));
495 CleanupStack::PopAndDestroy(bitmap);
497 TRect clipRect(TPoint(0,0),size);
498 TRAP(err,clientVF->StartClientViewFinderL(0, CCamera::EFormatFbsBitmapColor64K, size, clipRect));
501 INFO_PRINTF1(_L("StartClientViewFinderL for Client ViewFinder: unexpected result!"));
504 CheckViewFinderNegNotification(vfHandle, result);
506 INFO_PRINTF1(_L("GetClientViewFinderStateL for Client ViewFinder"));
507 TBool activeVF = EFalse;;
508 TRAP(err,clientVF->GetClientViewFinderStateL(activeVF));
509 if(err != KErrNotSupported)
511 INFO_PRINTF1(_L("GetClientViewFinderStateL for Client ViewFinder: unexpected result!"));
515 INFO_PRINTF1(_L("StartHistogram for Client ViewFinder"));
516 histogram_CVF->StartHistogram();
517 CheckViewFinderNegNotification(vfHandle, result);
519 INFO_PRINTF1(_L("StopHistogram for Client ViewFinder"));
520 histogram_CVF->StopHistogram();
522 INFO_PRINTF1(_L("GetClientViewFinderPropertiesL for Client ViewFinder"));
524 CCamera::TFormat imageFormat=CCamera::EFormatFbsBitmapColor64K;
525 TRAP(err,clientVF->GetClientViewFinderPropertiesL(screenNumber, imageFormat, size, clipRect));
526 if(err != KErrNotSupported)
528 INFO_PRINTF1(_L("GetClientViewFinderPropertiesL for Client ViewFinder: unexpected result!"));
532 INFO_PRINTF1(_L("StopClientViewFinder for Client ViewFinder"));
533 clientVF->StopClientViewFinder();
535 CleanupStack::PopAndDestroy(histogram_CVF);
536 CleanupStack::PopAndDestroy(clientVF);
540 INFO_PRINTF1(_L("CCameraClientViewFinder object not created"));
543 CleanupStack::PopAndDestroy(camera);
547 INFO_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
555 /*------------------------------------------------------
556 Direct ViewFinder : RECamV2DirectViewFinderTest
557 *------------------------------------------------------*/
558 RECamV2DirectViewFinderTest* RECamV2DirectViewFinderTest::NewL(const TDesC& aTestStep)
560 RECamV2DirectViewFinderTest* self = new (ELeave) RECamV2DirectViewFinderTest(aTestStep);
564 RECamV2DirectViewFinderTest::RECamV2DirectViewFinderTest(const TDesC& aTestStep)
566 iTestStepName.Copy(aTestStep);
569 TVerdict RECamV2DirectViewFinderTest::DoTestStepL()
571 if(!iTestStepName.Compare(_L("MM-ECM-ADV-U-052-HP")))
573 return DoTestStep_52L();
575 return EInconclusive;
578 TVerdict RECamV2DirectViewFinderTest::DoTestStep_52L()
580 TVerdict verdict = EFail;
581 INFO_PRINTF1(_L("Alloc test"));
590 INFO_PRINTF2(_L("Fail count = %d"), i);
593 __UHEAP_SETFAIL(RHeap::EFailNext, i);
595 TRAP(err, verdict = DoV2DirectVFTestStepL());
597 TAny* testAlloc = User::Alloc(1);
598 TBool heapTestingComplete = (testAlloc == NULL) && (err==KErrNone);
599 User::Free(testAlloc);
604 if ((err != KErrNoMemory ) || heapTestingComplete)
606 INFO_PRINTF4(_L("err = %d, verdict = %d, Fail count = %d"), err, verdict, i);
607 INFO_PRINTF1(_L("Alloc testing completed successfully"));
615 TVerdict RECamV2DirectViewFinderTest::DoV2DirectVFTestStepL()
617 TVerdict result = EPass;
618 CCamera* camera = NULL;
620 MCameraObserver* observer = NULL;
621 MDirectViewFinderObserver* directVFObserver = NULL;
623 TInt error = KErrNone;
624 CCamera::CCameraV2DirectViewFinder* directVF = NULL;
628 INFO_PRINTF1(_L("Create camera using Camera::NewL() and MCameraObserver"));
629 TRAP(error, camera = CCamera::NewL(*observer, 0));
632 CleanupStack::PushL(camera);
633 INFO_PRINTF1(_L("Create v2 direct viewfinder from CCamera object"));
635 TRAP(error, directVF = CCamera::CCameraV2DirectViewFinder::NewL(*camera, *directVFObserver));
636 if (error==KErrExtensionNotSupported)
638 INFO_PRINTF1(_L("CCameraV2DirectViewFinder object creation using old Observer failed with correct error"));
642 INFO_PRINTF1(_L("CCameraV2DirectViewFinder object creation using old Observer gave unexpected result"));
645 CleanupStack::PopAndDestroy(camera);
649 INFO_PRINTF2(_L("Unexpected %d return from CCamera::NewL()"), error);
651 User::Leave(KErrNoMemory);
655 // using observer2 with NewL
656 MCameraObserver2* observer2 = NULL;
658 INFO_PRINTF1(_L("Create camera using Camera::NewL() and MCameraObserver2"));
659 TRAP(error, camera = CCamera::NewL(*observer2, 0,0));
662 CleanupStack::PushL(camera);
663 INFO_PRINTF1(_L("Create v2 direct viewfinder from CCamera object"));
665 TRAP(error, directVF = CCamera::CCameraV2DirectViewFinder::NewL(*camera, *directVFObserver));
666 if (error==KErrExtensionNotSupported)
668 INFO_PRINTF1(_L("CCameraV2DirectViewFinder object creation using Observer2 with NewL failed with correct error"));
672 INFO_PRINTF1(_L("CCameraV2DirectViewFinder object creation using Observer2 with NewL gave unexpected result"));
675 CleanupStack::PopAndDestroy(camera);
679 INFO_PRINTF2(_L("Unexpected %d return from CCamera::NewL()"), error);
681 User::Leave(KErrNoMemory);
685 // create v2 direct viewfinder object using New2L
687 INFO_PRINTF1(_L("Create camera using Camera::New2L() and MCameraObserver2"));
689 TRAP(error, camera = CCamera::New2L(*observer2, 0,0));
692 CleanupStack::PushL(camera);
693 INFO_PRINTF1(_L("KErrNone return from CCamera::New2L()"));
694 TRAP(error, directVF = CCamera::CCameraV2DirectViewFinder::NewL(*camera, *directVFObserver));
698 CleanupStack::PushL(directVF);
699 INFO_PRINTF1(_L("CCameraV2DirectViewFinder object was created using NewL"));
700 CleanupStack::PopAndDestroy(directVF);
704 INFO_PRINTF1(_L("CCameraV2DirectViewFinder object was not created using NewL"));
706 User::Leave(KErrNoMemory);
708 CleanupStack::PopAndDestroy(camera);
712 INFO_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
714 User::Leave(KErrNoMemory);
721 /*------------------------------------------------------
722 Direct ViewFinder : RECamV2DirectVFNotificationTest
723 *------------------------------------------------------*/
724 RECamV2DirectVFNotificationTest* RECamV2DirectVFNotificationTest::NewL(TBool aAllocTest)
726 RECamV2DirectVFNotificationTest* self = new (ELeave) RECamV2DirectVFNotificationTest(aAllocTest);
727 CleanupStack::PushL(self);
729 CleanupStack::Pop(self);
733 void RECamV2DirectVFNotificationTest::ConstructL()
737 RECamV2DirectVFNotificationTest::RECamV2DirectVFNotificationTest(TBool /*aAllocTest*/)
739 iTestStepName = _L("MM-ECM-ADV-U-053-HP");
742 void RECamV2DirectVFNotificationTest::DirectViewFinderFirstFrameDisplayed(CCamera::CCameraV2DirectViewFinder& aDirectViewFinderHandle, TInt aErrorCode)
744 aDirectViewFinderHandle.GetViewFinderHandleL(iVFHandle);
748 void RECamV2DirectVFNotificationTest::DirectHistogramDisplayed(CCamera::CCameraV2DirectViewFinder& aDirectViewFinderHandle, CCamera::CCameraV2Histogram& /*aDirectHistogramDisplayed*/, TInt aErrorCode)
750 aDirectViewFinderHandle.GetViewFinderHandleL(iVFHandle);
754 void RECamV2DirectVFNotificationTest::ClientHistogramReady(CCamera::CCameraV2DirectViewFinder& aDirectViewFinderHandle, MHistogramV2Buffer* /*aClientHistogramBuffer*/, TInt aErrorCode)
756 aDirectViewFinderHandle.GetViewFinderHandleL(iVFHandle);
760 void RECamV2DirectVFNotificationTest::DirectViewFinderFailed(CCamera::CCameraV2DirectViewFinder& aDirectViewFinderHandle, TInt aErrorCode)
762 aDirectViewFinderHandle.GetViewFinderHandleL(iVFHandle);
766 void RECamV2DirectVFNotificationTest::DirectSnapshotForImageDisplayed(CCamera::CCameraV2DirectViewFinder& aDirectViewFinderHandle, CCamera::CCameraImageCapture& /*aCaptureImageHandle*/, TPostCaptureControlId /*aPostCaptureControlId*/, TInt aErrorCode)
768 aDirectViewFinderHandle.GetViewFinderHandleL(iVFHandle);
772 TInt RECamV2DirectVFNotificationTest::CustomInterface(TUid /*aInterface*/, TAny*& /*aPtrInterface*/)
777 void RECamV2DirectVFNotificationTest::CheckViewFinderNegNotification(TInt aVFHandle, TVerdict& aResult)
779 INFO_PRINTF4(_L("Expected DirectViewFinder Id %d, received event %x. Error %d."), aVFHandle, iVFHandle, iError);
780 if (aVFHandle != iVFHandle || iError != KErrNotSupported)
786 TVerdict RECamV2DirectVFNotificationTest::DoTestStepL()
788 TVerdict verdict = EFail;
789 INFO_PRINTF1(_L("Alloc test"));
797 INFO_PRINTF2(_L("Fail count = %d"), i);
800 __UHEAP_SETFAIL(RHeap::EFailNext,i);
803 TRAP(err,verdict = DoTestStep_53L());
805 TAny* testAlloc = User::Alloc(1);
806 TBool heapTestingComplete = ((testAlloc == NULL ) && (err == KErrNone));
807 User::Free(testAlloc);
809 if ((err != KErrNoMemory && verdict == EPass) || heapTestingComplete)
811 INFO_PRINTF4(_L("err = %d, verdict = %d, Fail count = %d"), err, verdict, i);
812 INFO_PRINTF1(_L("Alloc testing completed successfully"));
823 TVerdict RECamV2DirectVFNotificationTest::DoTestStep_53L()
825 TVerdict result = EPass;
826 CCamera* camera = NULL;
828 TInt error = KErrNone;
829 CCamera::CCameraV2DirectViewFinder* directVF = NULL;
831 // create client viewfinder object using New2L
833 INFO_PRINTF1(_L("Create camera using Camera::New2L() and MCameraObserver2"));
835 TRAP(error, camera = CCamera::New2L(*this, 0, 0));
839 CleanupStack::PushL(camera);
840 INFO_PRINTF1(_L("KErrNone return from CCamera::New2L()"));
841 TRAP(error, directVF = CCamera::CCameraV2DirectViewFinder::NewL(*camera, *this));
845 CleanupStack::PushL(directVF);
846 INFO_PRINTF1(_L("CCameraV2DirectViewFinder object was created using NewL"));
847 //Test Direct ViewFinder APIs
848 INFO_PRINTF1(_L("Create Histogram for Direct ViewFinder"));
849 CCamera::CCameraV2Histogram* histogram_DVF = directVF->CreateHistogramHandleL();
852 INFO_PRINTF1(_L("Histogram creation for Direct ViewFinder unsuccessful"));
856 CleanupStack::PushL(histogram_DVF);
858 INFO_PRINTF1(_L("Create ImageProcessing for Direct ViewFinder"));
860 TRAPD(err, directVF->GetTransformationHandleL());
861 if(err != KErrNotSupported)
863 INFO_PRINTF1(_L("ImageProcessing creation for Direct ViewFinder: unexpected result!"));
867 //set properties for direct VF (base class)
868 INFO_PRINTF1(_L("GetViewFinderFadingCapabilitiesL for Direct ViewFinder"));
869 CCameraViewFinder::TViewFinderFadingCapabilities fadingCapabilities;
870 TRAP(err,directVF->GetViewFinderFadingCapabilitiesL(fadingCapabilities));
871 if(err != KErrNotSupported)
873 INFO_PRINTF1(_L("GetViewFinderFadingCapabilitiesL for Direct ViewFinder: unexpected result!"));
877 INFO_PRINTF1(_L("GetViewFinderFadingEffectL for Direct ViewFinder"));
878 CCameraViewFinder::TViewFinderFadingEffect fadingEffect;
879 TRAP(err,directVF->GetViewFinderFadingEffectL(fadingEffect));
880 if(err != KErrNotSupported)
882 INFO_PRINTF1(_L("GetViewFinderFadingEffectL for Direct ViewFinder: unexpected result!"));
886 INFO_PRINTF1(_L("SetViewFinderFadingEffectL for Direct ViewFinder"));
887 iInputEventUid = KUidECamEvent2ViewFinderFadingEffect;
888 directVF->SetViewFinderFadingEffectL(fadingEffect);
889 CheckNotificationNeg(iInputEventUid, result);
892 directVF->GetViewFinderHandleL(vfHandle);
894 //set properties for histogram (for viewfinder)
895 TUint supportedHistogramType=0;
896 histogram_DVF->GetSupportedHistogramsL(supportedHistogramType);
897 if(supportedHistogramType!=0)
899 INFO_PRINTF1(_L("unexpected GetSupportedHistogramsL"));
903 INFO_PRINTF1(_L("GetDirectHistogramSupportInfoL for Histogram for Direct ViewFinder"));
904 TBool directHistogramSupported = EFalse;
905 TRAP(err,histogram_DVF->GetDirectHistogramSupportInfoL(directHistogramSupported));
906 if(err != KErrNotSupported)
908 INFO_PRINTF1(_L("GetDirectHistogramSupportInfoL for Histogram for Direct ViewFinder: unexpected result!"));
912 INFO_PRINTF1(_L("PrepareClientHistogramL for Histogram for Direct ViewFinder"));
913 CCamera::CCameraV2Histogram::THistogramType histogramType = CCamera::CCameraV2Histogram::EHistNone;
914 TRAP(err,histogram_DVF->PrepareClientHistogramL(histogramType));
915 if(err != KErrNotSupported)
917 INFO_PRINTF1(_L("PrepareClientHistogramL for Histogram for Direct ViewFinder: unexpected result!"));
921 INFO_PRINTF1(_L("PrepareDirectHistogramL for Histogram for Direct ViewFinder"));
922 CCamera::CCameraV2Histogram::TDirectHistogramParameters histogramParameters;
923 TRAP(err,histogram_DVF->PrepareDirectHistogramL(histogramParameters));
924 if(err != KErrNotSupported)
926 INFO_PRINTF1(_L("PrepareDirectHistogramL for Histogram for Direct ViewFinder: unexpected result!"));
930 INFO_PRINTF1(_L("UpdateDirectHistogramPropertiesL for Histogram for Direct ViewFinder"));
931 TRAP(err,histogram_DVF->UpdateDirectHistogramPropertiesL(histogramParameters));
932 if(err != KErrNotSupported)
934 INFO_PRINTF1(_L("UpdateDirectHistogramPropertiesL for Histogram for Direct ViewFinder: unexpected result!"));
938 INFO_PRINTF1(_L("GetDirectHistogramPropertiesL for Histogram for Direct ViewFinder"));
939 TRAP(err,histogram_DVF->GetDirectHistogramPropertiesL(histogramParameters));
940 if(err != KErrNotSupported)
942 INFO_PRINTF1(_L("GetDirectHistogramPropertiesL for Histogram for Direct ViewFinder: unexpected result!"));
946 INFO_PRINTF1(_L("GetHistogramStateL for Histogram for Direct ViewFinder"));
947 TBool histogramActive = EFalse;
948 TRAP(err,histogram_DVF->GetHistogramStateL(histogramActive));
949 if(err != KErrNotSupported)
951 INFO_PRINTF1(_L("GetHistogramStateL for Histogram for Direct ViewFinder: unexpected result!"));
955 //viewfinder starting...
956 INFO_PRINTF1(_L("StartViewFinderDirectL for Direct ViewFinder"));
958 TRect rect(TPoint(0,0),size);
959 TRect cliprect(rect);
961 CWsScreenDevice* screenDevice = NULL;
963 TRAP(err,directVF->StartViewFinderDirectL(ws, *screenDevice, window, rect));
966 INFO_PRINTF1(_L("StartViewFinderDirectL for Direct ViewFinder: unexpected result!"));
969 CheckViewFinderNegNotification(vfHandle, result);
971 TRAP(err,directVF->StartViewFinderDirectL(ws, *screenDevice, window, rect, cliprect));
974 INFO_PRINTF1(_L("StartViewFinderDirectL (with cliprect) for Direct ViewFinder: unexpected result!"));
977 CheckViewFinderNegNotification(vfHandle, result);
979 INFO_PRINTF1(_L("GetDirectViewFinderPropertiesL for Direct ViewFinder"));
981 TRAP(err,directVF->GetDirectViewFinderPropertiesL(screenNumber, rect, cliprect));
982 if(err != KErrNotSupported)
984 INFO_PRINTF1(_L("GetDirectViewFinderPropertiesL for Direct ViewFinder: unexpected result!"));
988 INFO_PRINTF1(_L("PauseViewFinderDirect for Direct ViewFinder"));
989 directVF->PauseViewFinderDirect();
991 INFO_PRINTF1(_L("ResumeViewFinderDirect for Direct ViewFinder"));
992 directVF->ResumeViewFinderDirect();
993 CheckViewFinderNegNotification(vfHandle, result);
995 INFO_PRINTF1(_L("StartHistogram for Direct ViewFinder"));
996 histogram_DVF->StartHistogram();
997 CheckViewFinderNegNotification(vfHandle, result);
999 INFO_PRINTF1(_L("StopHistogram for Direct ViewFinder"));
1000 histogram_DVF->StopHistogram();
1002 INFO_PRINTF1(_L("GetViewFinderStateL for Direct ViewFinder"));
1003 CCamera::CCameraV2DirectViewFinder::TViewFinderState vfState = CCamera::CCameraV2DirectViewFinder::EViewFinderInActive;
1004 TRAP(err,directVF->GetViewFinderStateL(vfState));
1005 if(err != KErrNotSupported)
1007 INFO_PRINTF1(_L("GetViewFinderStateL for Direct ViewFinder: unexpected result!"));
1011 //access direct snapshot functionality
1012 INFO_PRINTF1(_L("Access direct snapshot functionality"));
1013 CCamera::CCameraDirectSnapshot* directSnapshot = directVF->GetDirectSnapshotHandleL();
1014 if(directSnapshot == NULL)
1016 INFO_PRINTF1(_L("Direct Snapshot creation for Direct ViewFinder unsuccessful"));
1020 CleanupStack::PushL(directSnapshot);
1022 INFO_PRINTF1(_L("Get parent viewfinder for direct snapshot"));
1023 CCamera::CCameraV2DirectViewFinder* directViewFinder = NULL;
1024 TRAP(err, directSnapshot->GetDirectViewFinderL(directViewFinder));
1027 INFO_PRINTF1(_L("GetDirectViewFinderL for Direct ViewFinder Snapshot: unexpected result!"));
1031 TInt viewfinderHandle = -1;
1032 directViewFinder->GetViewFinderHandleL(viewfinderHandle);
1033 if(vfHandle != viewfinderHandle)
1035 INFO_PRINTF1(_L("Parent Viewfinder for Direct ViewFinder Snapshot: unexpected result!"));
1039 CCamera::CCameraDirectSnapshot::TDirectSnapshotParameters directSnapshotParameters;
1041 if(directSnapshotParameters.Size() != sizeof(CCamera::CCameraDirectSnapshot::TDirectSnapshotParameters) ||
1042 directSnapshotParameters.Version() != KECamDirectSnapshotParametersCurrentVersion)
1044 INFO_PRINTF1(_L("TDirectSnapshotParameters has different version for Direct Snapshot: unexpected result!"));
1048 INFO_PRINTF1(_L("SetAspectRatioState for Direct Snapshot"));
1049 directSnapshotParameters.SetAspectRatioState(ETrue);
1050 TBool aspectRatioState = directSnapshotParameters.IsAspectRatioMaintained();
1051 if(!aspectRatioState)
1053 INFO_PRINTF1(_L("AspectRatioState for Direct Snapshot: unexpected result!"));
1057 directSnapshotParameters.SetAspectRatioState(EFalse);
1058 aspectRatioState = directSnapshotParameters.IsAspectRatioMaintained();
1059 if(aspectRatioState != EFalse)
1061 INFO_PRINTF1(_L("AspectRatioState for Direct Snapshot: unexpected result!"));
1065 INFO_PRINTF1(_L("EnableDirectSnapshotL for Direct Snapshot"));
1066 TRAP(err, directSnapshot->EnableDirectSnapshotL(directSnapshotParameters));
1069 INFO_PRINTF1(_L("EnableDirectSnapshotL for DirectSnapshot: unexpected result!"));
1073 INFO_PRINTF1(_L("GetDirectSnapshotStateL for Direct Snapshot"));
1074 CCamera::CCameraDirectSnapshot::TDirectSnapshotState directSnapshotState;
1075 TRAP(err, directSnapshot->GetDirectSnapshotStateL(directSnapshotState));
1078 INFO_PRINTF1(_L("GetDirectSnapshotStateL for DirectSnapshot: unexpected result!"));
1082 if(CCamera::CCameraDirectSnapshot::EDirectSnapshotEnabled != directSnapshotState)
1084 INFO_PRINTF1(_L("DirectSnapshotState not set properly: unexpected result!"));
1088 INFO_PRINTF1(_L("GetDirectSnapshotParametersL for Direct Snapshot"));
1089 CCamera::CCameraDirectSnapshot::TDirectSnapshotParameters directSnapshotParam;
1090 TRAP(err, directSnapshot->GetDirectSnapshotParametersL(directSnapshotParam));
1093 INFO_PRINTF1(_L("GetDirectSnapshotParametersL for DirectSnapshot: unexpected result!"));
1097 if(directSnapshotParam.IsAspectRatioMaintained() != directSnapshotParameters.IsAspectRatioMaintained())
1099 INFO_PRINTF1(_L("DirectSnapshotParameters for DirectSnapshot wrongly set: unexpected result!"));
1103 INFO_PRINTF1(_L("SetDirectSnapshotParametersL for Direct Snapshot"));
1104 directSnapshotParameters.SetAspectRatioState(ETrue);
1105 TRAP(err, directSnapshot->SetDirectSnapshotParametersL(directSnapshotParameters));
1108 INFO_PRINTF1(_L("SetDirectSnapshotParametersL for DirectSnapshot: unexpected result!"));
1112 INFO_PRINTF1(_L("DisableDirectSnapshot for Direct Snapshot"));
1113 directSnapshot->DisableDirectSnapshot();
1114 TRAP(err, directSnapshot->GetDirectSnapshotStateL(directSnapshotState));
1117 INFO_PRINTF1(_L("GetDirectSnapshotStateL for DirectSnapshot: unexpected result!"));
1121 if(CCamera::CCameraDirectSnapshot::EDirectSnapshotDisabled != directSnapshotState)
1123 INFO_PRINTF1(_L("GetDirectSnapshotStateL for DirectSnapshot: unexpected result!"));
1127 INFO_PRINTF1(_L("StopDirectViewFinder for Direct ViewFinder"));
1128 directVF->StopDirectViewFinder();
1130 CleanupStack::PopAndDestroy(directSnapshot);
1131 CleanupStack::PopAndDestroy(histogram_DVF);
1132 CleanupStack::PopAndDestroy(directVF);
1136 INFO_PRINTF1(_L("CCameraV2DirectViewFinder object not created"));
1139 CleanupStack::PopAndDestroy(camera);
1143 INFO_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
1150 /*------------------------------------------------------------------
1151 Pre Image Capture Control : RECamPreImgCaptureNotificationTest
1152 *-----------------------------------------------------------------*/
1153 RECamPreImgCaptureNotificationTest* RECamPreImgCaptureNotificationTest::NewL(TBool aAllocTest)
1155 return new (ELeave)RECamPreImgCaptureNotificationTest(aAllocTest);
1158 RECamPreImgCaptureNotificationTest::RECamPreImgCaptureNotificationTest(TBool /*aAllocTest*/)
1160 iTestStepName = _L("MM-ECM-ADV-U-054-HP");
1161 iCaptureImageHandle = NULL;
1164 void RECamPreImgCaptureNotificationTest::PrepareImageComplete(CCamera::CCameraImageCapture* aCaptureImageHandle, TInt aErrorCode)
1166 iCaptureImageHandle = aCaptureImageHandle;
1167 iError = aErrorCode;
1170 TInt RECamPreImgCaptureNotificationTest::CustomInterface(TUid /*aInterface*/, TAny*& /*aPtrInterface*/)
1175 void RECamPreImgCaptureNotificationTest::CheckCaptureNotification(CCamera::CCameraImageCapture*& aImageCapture, TVerdict& aResult)
1177 INFO_PRINTF2(_L("Pre Image Capture Control Error %d, "), iError);
1178 if (iError != KErrNone)
1184 aImageCapture = iCaptureImageHandle;
1188 TVerdict RECamPreImgCaptureNotificationTest::DoTestStepL()
1190 TVerdict verdict = EFail;
1191 INFO_PRINTF1(_L("Alloc test"));
1199 INFO_PRINTF2(_L("Fail count = %d"), i);
1202 __UHEAP_SETFAIL(RHeap::EFailNext,i);
1205 TRAP(err,verdict = DoPreImgCaptureTestStepL());
1207 TAny* testAlloc = User::Alloc(1);
1208 TBool heapTestingComplete = ((testAlloc == NULL ) && (err == KErrNone));
1209 User::Free(testAlloc);
1211 if ((err != KErrNoMemory && verdict == EPass) || heapTestingComplete)
1213 INFO_PRINTF4(_L("err = %d, verdict = %d, Fail count = %d"), err, verdict, i);
1214 INFO_PRINTF1(_L("Alloc testing completed successfully"));
1225 TVerdict RECamPreImgCaptureNotificationTest::DoPreImgCaptureTestStepL()
1227 TVerdict result = EPass;
1228 CCamera* camera = NULL;
1230 TInt error = KErrNone;
1231 CCamera::CCameraPreImageCaptureControl* preImgCapture = NULL;
1235 MCameraObserver* observer=NULL;
1236 INFO_PRINTF1(_L("Create camera using Camera::NewL() and MCameraObserver"));
1237 TRAP(error, camera = CCamera::NewL(*observer, 0));
1238 if (error==KErrNone)
1240 CleanupStack::PushL(camera);
1241 INFO_PRINTF1(_L("Create PreImageCaptureControl from CCamera object"));
1243 TRAP(error, preImgCapture = CCamera::CCameraPreImageCaptureControl::NewL(*camera, *this));
1244 if (error==KErrExtensionNotSupported)
1246 INFO_PRINTF1(_L("CCameraPreImageCaptureControl object creation using old Observer failed with correct error"));
1250 INFO_PRINTF1(_L("CCameraPreImageCaptureControl object creation using old Observer gave unexpected result"));
1253 CleanupStack::PopAndDestroy(camera);
1257 INFO_PRINTF2(_L("Unexpected %d return from CCamera::NewL()"), error);
1259 User::Leave(KErrNoMemory);
1263 // using observer2 with NewL
1265 INFO_PRINTF1(_L("Create camera using Camera::NewL() and MCameraObserver2"));
1266 TRAP(error, camera = CCamera::NewL(*this, 0,0));
1267 if (error==KErrNone)
1269 CleanupStack::PushL(camera);
1270 INFO_PRINTF1(_L("Create PreImageCaptureControl from CCamera object"));
1272 TRAP(error, preImgCapture = CCamera::CCameraPreImageCaptureControl::NewL(*camera, *this));
1273 if (error==KErrExtensionNotSupported)
1275 INFO_PRINTF1(_L("CCameraPreImageCaptureControl object creation using Observer2 with NewL failed with correct error"));
1279 INFO_PRINTF1(_L("CCameraPreImageCaptureControl object creation using Observer2 with NewL gave unexpected result"));
1282 CleanupStack::PopAndDestroy(camera);
1286 INFO_PRINTF2(_L("Unexpected %d return from CCamera::NewL()"), error);
1288 User::Leave(KErrNoMemory);
1292 // create pre image control object using New2L
1294 INFO_PRINTF1(_L("Create camera using Camera::New2L() and MCameraObserver2"));
1296 TRAP(error, camera = CCamera::New2L(*this, 0,0));
1297 if (error==KErrNone)
1299 CleanupStack::PushL(camera);
1300 INFO_PRINTF1(_L("KErrNone return from CCamera::New2L()"));
1301 TRAP(error, preImgCapture = CCamera::CCameraPreImageCaptureControl::NewL(*camera, *this));
1303 if (error==KErrNone)
1305 CleanupStack::PushL(preImgCapture);
1306 INFO_PRINTF1(_L("CCameraPreImageCaptureControl object was created using NewL"));
1308 INFO_PRINTF1(_L("GetDirectSnapshotSupportInfoL for PreImageCaptureControl"));
1309 TUint directSnapshotSupportInfo = 0;
1310 TRAPD(err, preImgCapture->GetDirectSnapshotSupportInfoL(directSnapshotSupportInfo));
1313 INFO_PRINTF1(_L("GetDirectSnapshotSupportInfoL for PreImageCaptureControl : unexpected result!"));
1317 INFO_PRINTF1(_L("GetSupportedEmbeddedStillCaptureSettingsL for PreImageCaptureControl"));
1318 RArray<TUid> supportedEmbeddedStillCaptureSettings;
1319 TRAP(err, preImgCapture->GetSupportedEmbeddedStillCaptureSettingsL(supportedEmbeddedStillCaptureSettings));
1322 INFO_PRINTF1(_L("GetSupportedEmbeddedStillCaptureSettingsL for PreImageCaptureControl : unexpected result!"));
1326 if(supportedEmbeddedStillCaptureSettings.Count() != 0)
1328 INFO_PRINTF1(_L("Number of SupportedEmbeddedStillCaptureSettings for PreImageCaptureControl : unexpected result!"));
1332 INFO_PRINTF1(_L("GetSupportedDirectSavingTypeL for PreImageCaptureControl"));
1333 CCamera::CCameraPreImageCaptureControl::TDirectSavingType supportedDirectSavingType
1334 = CCamera::CCameraPreImageCaptureControl::EDirectSavingNotUsed;
1335 TRAP(err, preImgCapture->GetSupportedDirectSavingTypeL(supportedDirectSavingType));
1338 INFO_PRINTF1(_L("GetSupportedDirectSavingTypeL for PreImageCaptureControl : unexpected result!"));
1342 INFO_PRINTF1(_L("SetSequentialImageFilenameL for PreImageCaptureControl"));
1343 _LIT8(KDirectSavingFileName, "C:\\ECam.jpg");
1345 TRAP(err, preImgCapture->SetSequentialImageFilenameL(KDirectSavingFileName, seqNum));
1346 if(err != KErrNotSupported)
1348 INFO_PRINTF1(_L("SetSequentialImageFilenameL for PreImageCaptureControl : unexpected result!"));
1352 INFO_PRINTF1(_L("SetLowerResolutionSequentialImageFilenameL for PreImageCaptureControl"));
1353 _LIT8(KLowResDirectSavingFileName, "C:\\ECamLowRes.jpg");
1354 TRAP(err, preImgCapture->SetLowerResolutionSequentialImageFilenameL(KLowResDirectSavingFileName, seqNum));
1355 if(err != KErrNotSupported)
1357 INFO_PRINTF1(_L("SetLowerResolutionSequentialImageFilenameL for PreImageCaptureControl : unexpected result!"));
1361 INFO_PRINTF1(_L("GetDirectSavingTypeL for PreImageCaptureControl"));
1362 CCamera::CCameraPreImageCaptureControl::TDirectSavingType directSavingType
1363 = CCamera::CCameraPreImageCaptureControl::EDirectSavingNotUsed;
1364 TRAP(err, preImgCapture->GetDirectSavingTypeL(directSavingType));
1367 INFO_PRINTF1(_L("GetDirectSavingTypeL for PreImageCaptureControl : unexpected result!"));
1371 INFO_PRINTF1(_L("SetDirectSavingTypeL for PreImageCaptureControl"));
1372 TRAP(err, preImgCapture->SetDirectSavingTypeL(CCamera::CCameraPreImageCaptureControl::EDirectSavingHighResolutionFileOnly));
1373 if(err != KErrNotSupported)
1375 INFO_PRINTF1(_L("SetDirectSavingTypeL for PreImageCaptureControl : unexpected result!"));
1379 INFO_PRINTF1(_L("GetCaptureEventSupportInfoL for PreImageCaptureControl"));
1380 TUint supportedDriveModes = 0;
1381 TRAP(err, preImgCapture->GetCaptureEventSupportInfoL(supportedDriveModes));
1384 INFO_PRINTF1(_L("GetCaptureEventSupportInfoL for PreImageCaptureControl : unexpected result!"));
1388 INFO_PRINTF1(_L("GetImageFormatsSupportedL for PreImageCaptureControl"));
1389 TSize size(640,480);
1390 TUint imageFormatsSupported = 0;
1391 TRAP(err, preImgCapture->GetImageFormatsSupportedL(imageFormatsSupported, size));
1394 INFO_PRINTF1(_L("GetImageFormatsSupportedL for PreImageCaptureControl : unexpected result!"));
1398 INFO_PRINTF1(_L("GetPixelAspectsSupportedL for PreImageCaptureControl"));
1399 TUint pixelAspectsSupported = 0;
1400 TRAP(err, preImgCapture->GetPixelAspectsSupportedL(pixelAspectsSupported, CCamera::EFormatFbsBitmapColor16M, size));
1403 INFO_PRINTF1(_L("GetPixelAspectsSupportedL for PreImageCaptureControl : unexpected result!"));
1407 INFO_PRINTF1(_L("GetImageMaxMemorySizeSettingSupportInfoL for PreImageCaptureControl"));
1408 TBool maxMemorySizeSettingSupported = EFalse;
1409 TRAP(err, preImgCapture->GetImageMaxMemorySizeSettingSupportInfoL(maxMemorySizeSettingSupported));
1412 INFO_PRINTF1(_L("GetImageMaxMemorySizeSettingSupportInfoL for PreImageCaptureControl : unexpected result!"));
1416 INFO_PRINTF1(_L("GetImageMaxMemorySizeL for PreImageCaptureControl"));
1417 TUint memorySize = 0;
1418 TRAP(err, preImgCapture->GetImageMaxMemorySizeL(memorySize));
1419 if(err != KErrNotSupported)
1421 INFO_PRINTF1(_L("GetImageMaxMemorySizeL for PreImageCaptureControl : unexpected result!"));
1425 INFO_PRINTF1(_L("GetSupportedProcessingOptionsL for PreImageCaptureControl"));
1426 TUint processingOptions = 0;
1427 TRAP(err, preImgCapture->GetSupportedProcessingOptionsL(processingOptions));
1428 if(err != KErrNotSupported)
1430 INFO_PRINTF1(_L("GetSupportedProcessingOptionsL for PreImageCaptureControl : unexpected result!"));
1433 INFO_PRINTF1(_L("PrepareImageCapture for PreImageCaptureControl"));
1434 CCamera::CCameraPreImageCaptureControl::TPrepareImageParameters prepareImageParameters;
1436 INFO_PRINTF1(_L("Setting processing options member variable"));
1438 options |= CCamera::CCameraPreImageCaptureControl::EEcamNormalProcessing;
1439 prepareImageParameters.SetImageProcessingOptions(options);
1440 INFO_PRINTF1(_L("Getting processing options member variable"));
1441 TUint retrievedOptions = 0;
1442 prepareImageParameters.GetImageProcessingOptions(retrievedOptions);
1443 if(retrievedOptions != options)
1445 INFO_PRINTF1(_L("Set image processing option does not match retrieved image processing option"));
1450 INFO_PRINTF1(_L("Set image processing option matches retrieved image processing option"));
1453 MCaptureImageObserver* captureImageObserver = NULL;
1454 preImgCapture->PrepareImageCapture(prepareImageParameters, *captureImageObserver);
1455 CCamera::CCameraImageCapture* imageCapture = NULL;
1456 CheckCaptureNotification(imageCapture, result);
1458 if(imageCapture == NULL)
1460 INFO_PRINTF1(_L("CCameraImageCapture object not created!"));
1465 delete imageCapture;
1468 CleanupStack::PopAndDestroy(preImgCapture);
1472 INFO_PRINTF1(_L("CCameraPreImageCaptureControl object was not created using NewL"));
1475 CleanupStack::PopAndDestroy(camera);
1479 INFO_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
1486 /*------------------------------------------------------------------
1487 Image Capture Control : RECamImgCaptureNotificationTest
1488 *-----------------------------------------------------------------*/
1489 RECamImgCaptureNotificationTest* RECamImgCaptureNotificationTest::NewL(TBool aAllocTest)
1491 return new (ELeave)RECamImgCaptureNotificationTest(aAllocTest);
1494 RECamImgCaptureNotificationTest::RECamImgCaptureNotificationTest(TBool /*aAllocTest*/)
1496 iTestStepName = _L("MM-ECM-ADV-U-055-HP");
1497 iCaptureImageHandle = NULL;
1500 void RECamImgCaptureNotificationTest::PrepareImageComplete(CCamera::CCameraImageCapture* aCaptureImageHandle, TInt aErrorCode)
1502 iCaptureImageHandle = aCaptureImageHandle;
1503 iError = aErrorCode;
1506 TInt RECamImgCaptureNotificationTest::CustomInterface(TUid /*aInterface*/, TAny*& /*aPtrInterface*/)
1511 void RECamImgCaptureNotificationTest::CheckPreCaptureNotification(CCamera::CCameraImageCapture*& aImageCapture, TVerdict& aResult)
1513 INFO_PRINTF2(_L("Pre Image Capture Control Error %d, "), iError);
1514 if (iError != KErrNone)
1520 aImageCapture = iCaptureImageHandle;
1524 void RECamImgCaptureNotificationTest::IndividualImageControlHandle(CCamera::CCameraImageCapture& aCaptureImageHandle, TPostCaptureControlId aPostCaptureControlId)
1526 iCaptureImageHandle = &aCaptureImageHandle;
1527 iPostCaptureControlId = aPostCaptureControlId;
1530 void RECamImgCaptureNotificationTest::ImageBufferReady(CCamera::CCameraImageCapture& aCaptureImageHandle, TPostCaptureControlId aPostCaptureControlId, TInt aErrorCode)
1532 iCaptureImageHandle = &aCaptureImageHandle;
1533 iPostCaptureControlId = aPostCaptureControlId;
1534 iError = aErrorCode;
1537 void RECamImgCaptureNotificationTest::ClientSnapshotForImageReady(CCamera::CCameraImageCapture& aCaptureImageHandle, TPostCaptureControlId aPostCaptureControlId, MCameraBuffer2* /*aSnapshotBuffer*/, TInt aErrorCode)
1539 iCaptureImageHandle = &aCaptureImageHandle;
1540 iPostCaptureControlId = aPostCaptureControlId;
1541 iError = aErrorCode;
1544 void RECamImgCaptureNotificationTest::DirectSnapshotForImageDisplayed(CCamera::CCameraImageCapture& aCaptureImageHandle, TPostCaptureControlId aPostCaptureControlId, TInt aErrorCode)
1546 iCaptureImageHandle = &aCaptureImageHandle;
1547 iPostCaptureControlId = aPostCaptureControlId;
1548 iError = aErrorCode;
1551 void RECamImgCaptureNotificationTest::CutDownImageDirectSavingCompleted(CCamera::CCameraImageCapture& aCaptureImageHandle, TPostCaptureControlId aPostCaptureControlId, TInt aErrorCode)
1553 iCaptureImageHandle = &aCaptureImageHandle;
1554 iPostCaptureControlId = aPostCaptureControlId;
1555 iError = aErrorCode;
1558 void RECamImgCaptureNotificationTest::ImageDirectSavingCompleted(CCamera::CCameraImageCapture& aCaptureImageHandle, TPostCaptureControlId aPostCaptureControlId, TInt aErrorCode)
1560 iCaptureImageHandle = &aCaptureImageHandle;
1561 iPostCaptureControlId = aPostCaptureControlId;
1562 iError = aErrorCode;
1565 void RECamImgCaptureNotificationTest::ImageCaptureComplete(CCamera::CCameraImageCapture& aCaptureImageHandle, TInt aErrorCode)
1567 iCaptureImageHandle = &aCaptureImageHandle;
1568 iError = aErrorCode;
1571 void RECamImgCaptureNotificationTest::ClientHistogramForImageReady(CCamera::CCameraImageCapture& aCaptureImageHandle, TPostCaptureControlId aPostCaptureControlId, MHistogramV2Buffer* /*aClientHistogramBuffer*/, TInt aErrorCode)
1573 iCaptureImageHandle = &aCaptureImageHandle;
1574 iPostCaptureControlId = aPostCaptureControlId;
1575 iError = aErrorCode;
1578 void RECamImgCaptureNotificationTest::ClientHistogramForSnapshotReady(CCamera::CCameraImageCapture& aCaptureImageHandle, TPostCaptureControlId aPostCaptureControlId, MHistogramV2Buffer* /*aClientHistogramBuffer*/, TInt aErrorCode)
1580 iCaptureImageHandle = &aCaptureImageHandle;
1581 iPostCaptureControlId = aPostCaptureControlId;
1582 iError = aErrorCode;
1585 void RECamImgCaptureNotificationTest::DirectHistogramForSnapshotDisplayed(CCamera::CCameraImageCapture& aCaptureImageHandle, TPostCaptureControlId aPostCaptureControlId, CCamera::CCameraV2Histogram& /*aDirectHistogramDisplayed*/, TInt aErrorCode)
1587 iCaptureImageHandle = &aCaptureImageHandle;
1588 iPostCaptureControlId = aPostCaptureControlId;
1589 iError = aErrorCode;
1592 void RECamImgCaptureNotificationTest::ProcessingFailed(CCamera::CCameraImageCapture& aCaptureImageHandle, TPostCaptureControlId aPostCaptureControlId, TUint aProcessingTypes, TInt aErrorCode)
1594 iCaptureImageHandle = &aCaptureImageHandle;
1595 iPostCaptureControlId = aPostCaptureControlId;
1596 iProcessingTypes = aProcessingTypes;
1597 iError = aErrorCode;
1600 void RECamImgCaptureNotificationTest::CheckCaptureNotification(CCamera::CCameraImageCapture*& aImageCapture, TPostCaptureControlId& aPostCaptureControlId, TVerdict& aResult)
1602 INFO_PRINTF2(_L("Image Capture Control Error %d, "), iError);
1603 if (iError != KErrNotSupported)
1609 aImageCapture = iCaptureImageHandle;
1610 aPostCaptureControlId = iPostCaptureControlId;
1614 void RECamImgCaptureNotificationTest::CheckCaptureCompletion(CCamera::CCameraImageCapture*& aImageCapture, TVerdict& aResult)
1616 INFO_PRINTF2(_L("Image Capture Control Error %d, "), iError);
1617 if (iError != KErrNotSupported)
1623 aImageCapture = iCaptureImageHandle;
1627 TVerdict RECamImgCaptureNotificationTest::DoTestStepL()
1629 TVerdict verdict = EFail;
1630 INFO_PRINTF1(_L("Alloc test"));
1640 INFO_PRINTF2(_L("Fail count = %d"), i);
1643 __UHEAP_SETFAIL(RHeap::EFailNext, i);
1645 TRAP(err, verdict = DoImgCaptureAdvFuncConstruction());
1647 TAny* testAlloc = User::Alloc(1);
1648 TBool heapTestingComplete = (testAlloc == NULL) && (err==KErrNone);
1649 User::Free(testAlloc);
1654 if ((err != KErrNoMemory && verdict == EPass) || heapTestingComplete)
1656 INFO_PRINTF4(_L("err = %d, verdict = %d, Fail count = %d"), err, verdict, i);
1657 INFO_PRINTF1(_L("Alloc testing completed successfully"));
1665 TVerdict RECamImgCaptureNotificationTest::DoImgCaptureAdvFuncConstruction()
1667 TVerdict result = EPass;
1668 CCamera* camera = NULL;
1670 TInt error = KErrNone;
1671 CCamera::CCameraPreImageCaptureControl* preImgCapture = NULL;
1673 // create pre image control object using New2L
1675 INFO_PRINTF1(_L("Create camera using Camera::New2L() and MCameraObserver2"));
1677 TRAP(error, camera = CCamera::New2L(*this, 0,0));
1678 if (error==KErrNone)
1680 CleanupStack::PushL(camera);
1681 INFO_PRINTF1(_L("KErrNone return from CCamera::New2L()"));
1682 TRAP(error, preImgCapture = CCamera::CCameraPreImageCaptureControl::NewL(*camera, *this));
1684 if (error==KErrNone)
1686 CleanupStack::PushL(preImgCapture);
1687 INFO_PRINTF1(_L("CCameraPreImageCaptureControl object was created using NewL"));
1689 INFO_PRINTF1(_L("PrepareImageCapture for PreImageCaptureControl"));
1690 CCamera::CCameraPreImageCaptureControl::TPrepareImageParameters prepareImageParameters;
1691 preImgCapture->PrepareImageCapture(prepareImageParameters, *this);
1692 CCamera::CCameraImageCapture* imageCapture = NULL;
1693 CheckPreCaptureNotification(imageCapture, result);
1695 if(imageCapture == NULL)
1697 INFO_PRINTF1(_L("CCameraImageCapture object not created!"));
1702 CleanupStack::PushL(imageCapture);
1703 // image capture opertions.
1705 INFO_PRINTF1(_L("Create Histogram for Image Capture"));
1706 CCamera::CCameraV2Histogram* histogram_IC = NULL;
1707 TRAP(error, histogram_IC = imageCapture->CreateHistogramHandleL());
1709 if(error != KErrNone /*|| !histogram_IC*/)
1711 INFO_PRINTF1(_L("Histogram creation for Image Capture unsuccessful"));
1713 CleanupStack::PopAndDestroy(imageCapture);
1714 CleanupStack::PopAndDestroy(preImgCapture);
1715 CleanupStack::PopAndDestroy(camera);
1719 CleanupStack::PushL(histogram_IC);
1721 INFO_PRINTF1(_L("Create ImageProcessing for Image Capture "));
1723 CCamera::CCameraImageProcessing* impProc = NULL;
1724 TRAP(error, impProc = imageCapture->GetTransformationHandleL());
1726 if(error != KErrNone /*|| !impProc*/)
1728 INFO_PRINTF1(_L("ImageProcessing creation for Image Capture unsuccessful"));
1730 CleanupStack::PopAndDestroy(histogram_IC);
1731 CleanupStack::PopAndDestroy(imageCapture);
1732 CleanupStack::PopAndDestroy(preImgCapture);
1733 CleanupStack::PopAndDestroy(camera);
1737 CleanupStack::PushL(impProc);
1739 INFO_PRINTF1(_L("Create snapshot for Image Capture"));
1740 TInt viewfinderID = 0;
1741 CCamera::CCameraSnapshot* snapshot_IC = NULL;
1742 TRAP(error,snapshot_IC = imageCapture->GetSnapshotHandleL(viewfinderID));
1744 if(error != KErrNone /*||!snapshot_IC*/)
1746 INFO_PRINTF1(_L("snapshot creation for Image Capture : unexpected result!"));
1748 CleanupStack::PopAndDestroy(impProc);
1749 CleanupStack::PopAndDestroy(histogram_IC);
1750 CleanupStack::PopAndDestroy(imageCapture);
1751 CleanupStack::PopAndDestroy(preImgCapture);
1752 CleanupStack::PopAndDestroy(camera);
1755 CleanupStack::PushL(snapshot_IC);
1757 INFO_PRINTF1(_L("Create histogram for snapshot for Image Capture"));
1758 CCamera::CCameraV2Histogram* histogram_snapshot_IC = NULL;
1760 TRAP(error, histogram_snapshot_IC = snapshot_IC->CreateHistogramHandleL());
1762 if(error != KErrNone /*|| !histogram_snapshot_IC*/)
1764 INFO_PRINTF1(_L("Histogram creation for snapshot for Image Capture unsuccessful"));
1766 CleanupStack::PopAndDestroy(snapshot_IC);
1767 CleanupStack::PopAndDestroy(impProc);
1768 CleanupStack::PopAndDestroy(histogram_IC);
1769 CleanupStack::PopAndDestroy(imageCapture);
1770 CleanupStack::PopAndDestroy(preImgCapture);
1771 CleanupStack::PopAndDestroy(camera);
1774 CleanupStack::PushL(histogram_snapshot_IC);
1776 //check img proc for image capture
1777 INFO_PRINTF1(_L("GetSupportedTransformationsL for imgProc for Image Capture"));
1778 RArray<TUid> transformations;
1779 TRAPD(err, impProc->GetSupportedTransformationsL(transformations));
1782 INFO_PRINTF1(_L("GetSupportedTransformationsL for imgProc for Image Capture : unexpected result!"));
1784 CleanupStack::PopAndDestroy(histogram_snapshot_IC);
1785 CleanupStack::PopAndDestroy(snapshot_IC);
1786 CleanupStack::PopAndDestroy(impProc);
1787 CleanupStack::PopAndDestroy(histogram_IC);
1788 CleanupStack::PopAndDestroy(imageCapture);
1789 CleanupStack::PopAndDestroy(preImgCapture);
1790 CleanupStack::PopAndDestroy(camera);
1793 if(transformations.Count() != 0)
1795 INFO_PRINTF1(_L("Number of SupportedTransformations for imgProc for Image Capture : unexpected result!"));
1798 transformations.Close();
1800 INFO_PRINTF1(_L("Check New Img Proc methods for Image Capture"));
1801 CCamera::CCameraImageProcessing::TOrientationReference orientationRef
1802 = CCamera::CCameraImageProcessing::EOrientationReferenceTiltOrientation;
1803 TUint suppRelativeRotation=0;
1804 TUint supportedRelMirroring=0;
1805 TUint supportedRelFlipping=0;
1806 TRAP(err, impProc->GetSupportedRelativeOrientationOptionsL(orientationRef, suppRelativeRotation, supportedRelMirroring, supportedRelFlipping));
1807 if(err != KErrNotSupported)
1809 INFO_PRINTF1(_L("GetSupportedRelativeOrientationOptionsL for imgProc for Image Capture : unexpected result!"));
1813 CCamera::CCameraImageProcessing::TRelativeRotation relRotation =
1814 CCamera::CCameraImageProcessing::ERelativeRotation0Degrees;
1816 CCamera::CCameraImageProcessing::TRelativeMirror relMirror =
1817 CCamera::CCameraImageProcessing::ERelativeMirrorNone;
1819 CCamera::CCameraImageProcessing::TRelativeFlipping relFlipping =
1820 CCamera::CCameraImageProcessing::ERelativeFlippingNone;
1822 TRAP(err, impProc->GetCurrentRelativeOrientationOptionsL(orientationRef, relRotation, relMirror, relFlipping));
1823 if(err != KErrNotSupported)
1825 INFO_PRINTF1(_L("GetCurrentRelativeOrientationOptionsL for imgProc for Image Capture : unexpected result!"));
1827 CleanupStack::PopAndDestroy(histogram_snapshot_IC);
1828 CleanupStack::PopAndDestroy(snapshot_IC);
1829 CleanupStack::PopAndDestroy(impProc);
1830 CleanupStack::PopAndDestroy(histogram_IC);
1831 CleanupStack::PopAndDestroy(imageCapture);
1832 CleanupStack::PopAndDestroy(preImgCapture);
1833 CleanupStack::PopAndDestroy(camera);
1837 TRAP(err, impProc->SetRelativeOrientationOptionsL(orientationRef, relRotation, relMirror, relFlipping));
1838 if(err != KErrNotSupported)
1840 INFO_PRINTF1(_L("SetRelativeOrientationOptionsL for imgProc for Image Capture : unexpected result!"));
1842 CleanupStack::PopAndDestroy(histogram_snapshot_IC);
1843 CleanupStack::PopAndDestroy(snapshot_IC);
1844 CleanupStack::PopAndDestroy(impProc);
1845 CleanupStack::PopAndDestroy(histogram_IC);
1846 CleanupStack::PopAndDestroy(imageCapture);
1847 CleanupStack::PopAndDestroy(preImgCapture);
1848 CleanupStack::PopAndDestroy(camera);
1852 //prepare histogram for image capture
1853 INFO_PRINTF1(_L("PrepareClientHistogramL for Histogram for Image Capture"));
1854 CCamera::CCameraV2Histogram::THistogramType histogramType = CCamera::CCameraV2Histogram::EHistNone;
1855 TRAP(err,histogram_IC->PrepareClientHistogramL(histogramType));
1856 if(err != KErrNotSupported)
1858 INFO_PRINTF1(_L("PrepareClientHistogramL for Histogram for Image Capture: unexpected result!"));
1860 CleanupStack::PopAndDestroy(histogram_snapshot_IC);
1861 CleanupStack::PopAndDestroy(snapshot_IC);
1862 CleanupStack::PopAndDestroy(impProc);
1863 CleanupStack::PopAndDestroy(histogram_IC);
1864 CleanupStack::PopAndDestroy(imageCapture);
1865 CleanupStack::PopAndDestroy(preImgCapture);
1866 CleanupStack::PopAndDestroy(camera);
1870 //prepare snapshot for image capture
1871 INFO_PRINTF1(_L("PrepareSnapshotL for Snapshot for Image Capture"));
1872 CCamera::CCameraSnapshot::TSnapshotParameters snapshotParam;
1873 TRAP(err,snapshot_IC->PrepareSnapshotL(snapshotParam));
1876 INFO_PRINTF1(_L("PrepareSnapshotL for Snapshot for Image Capture: unexpected result!"));
1878 CleanupStack::PopAndDestroy(histogram_snapshot_IC);
1879 CleanupStack::PopAndDestroy(snapshot_IC);
1880 CleanupStack::PopAndDestroy(impProc);
1881 CleanupStack::PopAndDestroy(histogram_IC);
1882 CleanupStack::PopAndDestroy(imageCapture);
1883 CleanupStack::PopAndDestroy(preImgCapture);
1884 CleanupStack::PopAndDestroy(camera);
1888 //prepare histogram for snapshot for image capture
1889 INFO_PRINTF1(_L("PrepareClientHistogramL for Histogram for snapshot for Image Capture"));
1890 TRAP(err,histogram_snapshot_IC->PrepareClientHistogramL(histogramType));
1891 if(err != KErrNotSupported)
1893 INFO_PRINTF1(_L("PrepareClientHistogramL for Histogram for Snapshot for Image Capture: unexpected result!"));
1895 CleanupStack::PopAndDestroy(histogram_snapshot_IC);
1896 CleanupStack::PopAndDestroy(snapshot_IC);
1897 CleanupStack::PopAndDestroy(impProc);
1898 CleanupStack::PopAndDestroy(histogram_IC);
1899 CleanupStack::PopAndDestroy(imageCapture);
1900 CleanupStack::PopAndDestroy(preImgCapture);
1901 CleanupStack::PopAndDestroy(camera);
1905 //image capture operations
1906 INFO_PRINTF1(_L("GetPrepareImageParametersL for Image Capture"));
1907 CCamera::CCameraPreImageCaptureControl::TPrepareImageParameters prepareImageParameters;
1908 TRAP(err,imageCapture->GetPrepareImageParametersL(prepareImageParameters));
1911 INFO_PRINTF1(_L("GetPrepareImageParametersL for Image Capture: unexpected result!"));
1913 CleanupStack::PopAndDestroy(histogram_snapshot_IC);
1914 CleanupStack::PopAndDestroy(snapshot_IC);
1915 CleanupStack::PopAndDestroy(impProc);
1916 CleanupStack::PopAndDestroy(histogram_IC);
1917 CleanupStack::PopAndDestroy(imageCapture);
1918 CleanupStack::PopAndDestroy(preImgCapture);
1919 CleanupStack::PopAndDestroy(camera);
1923 INFO_PRINTF1(_L("CaptureImage for Image Capture"));
1924 imageCapture->CaptureImage();
1926 CCamera::CCameraImageCapture* captImg = NULL;
1927 CCamera::CCameraPostImageCaptureControl* postImgCapt = NULL;
1928 TPostCaptureControlId postCaptureControlId = 0;
1930 TRAP(err, iCaptureImageHandle->GetPostCaptureControlHandleL(postImgCapt, iPostCaptureControlId));
1933 INFO_PRINTF1(_L("GetPostCaptureControlHandleL for Image Capture: unexpected result!"));
1935 CleanupStack::PopAndDestroy(histogram_snapshot_IC);
1936 CleanupStack::PopAndDestroy(snapshot_IC);
1937 CleanupStack::PopAndDestroy(impProc);
1938 CleanupStack::PopAndDestroy(histogram_IC);
1939 CleanupStack::PopAndDestroy(imageCapture);
1940 CleanupStack::PopAndDestroy(preImgCapture);
1941 CleanupStack::PopAndDestroy(camera);
1945 if(postImgCapt == NULL)
1947 INFO_PRINTF1(_L("PostCaptureControl object was not provided for Image Capture: unexpected result!"));
1952 CleanupStack::PushL(postImgCapt);
1953 //perform operations on post image capture control
1954 INFO_PRINTF1(_L("GetPostCaptureControlId for post imgCapt object for Image Capture"));
1955 TPostCaptureControlId postCaptCtrlId = 0;
1956 postImgCapt->GetPostCaptureControlId(postCaptCtrlId);
1957 if(postCaptCtrlId != iPostCaptureControlId)
1959 INFO_PRINTF1(_L("PostCaptureControlId unexpected!"));
1962 postCaptureControlId = postCaptCtrlId;
1964 INFO_PRINTF1(_L("ImageCaptureHandle for post imgCapt object for Image Capture"));
1965 TRAP(err, CCamera::CCameraImageCapture* captImg1 = postImgCapt->ImageCaptureHandle());
1966 if(err != KErrNone /*|| captImg1 == NULL*/)
1968 INFO_PRINTF1(_L("CCameraImageCapture object from post image capture object is NULL and unexpected!"));
1970 CleanupStack::PopAndDestroy(postImgCapt);
1971 CleanupStack::PopAndDestroy(histogram_snapshot_IC);
1972 CleanupStack::PopAndDestroy(snapshot_IC);
1973 CleanupStack::PopAndDestroy(impProc);
1974 CleanupStack::PopAndDestroy(histogram_IC);
1975 CleanupStack::PopAndDestroy(imageCapture);
1976 CleanupStack::PopAndDestroy(preImgCapture);
1977 CleanupStack::PopAndDestroy(camera);
1981 INFO_PRINTF1(_L("GetImageSequenceNumberL for post imgCapt object for Image Capture"));
1983 TRAP(err, postImgCapt->GetImageSequenceNumberL(seqNum));
1984 if(err != KErrNotSupported)
1986 INFO_PRINTF1(_L("GetImageSequenceNumberL for post image capture object unexpected!"));
1990 INFO_PRINTF1(_L("SetImagePriorityL for post imgCapt object for Image Capture"));
1991 TECamImagePriority imagePriority = EECamImagePriorityLow;
1992 TRAP(err, postImgCapt->SetImagePriorityL(imagePriority));
1993 if(err != KErrNotSupported)
1995 INFO_PRINTF1(_L("SetImagePriorityL for post image capture object unexpected!"));
1999 INFO_PRINTF1(_L("GetImagePriorityL for post imgCapt object for Image Capture"));
2000 TRAP(err, postImgCapt->GetImagePriorityL(imagePriority));
2001 if(err != KErrNotSupported)
2003 INFO_PRINTF1(_L("GetImagePriorityL for post image capture object unexpected!"));
2007 INFO_PRINTF1(_L("PauseProcessing for post imgCapt object for Image Capture"));
2008 postImgCapt->PauseProcessing(0);
2010 INFO_PRINTF1(_L("ResumeProcessingL for post imgCapt object for Image Capture"));
2011 TRAP(err, postImgCapt->ResumeProcessingL(0));
2012 if(err != KErrNotSupported)
2014 INFO_PRINTF1(_L("ResumeProcessingL for post image capture object unexpected!"));
2018 INFO_PRINTF1(_L("GetImageStateL for post imgCapt object for Image Capture"));
2019 CCamera::CCameraPostImageCaptureControl::TImageState imgState =
2020 CCamera::CCameraPostImageCaptureControl::EProcessingPending;
2021 TRAP(err, postImgCapt->GetImageStateL(imgState));
2022 if(err != KErrNotSupported)
2024 INFO_PRINTF1(_L("GetImageStateL for post image capture object unexpected!"));
2028 INFO_PRINTF1(_L("GetBufferStateL for post imgCapt object for Image Capture"));
2029 CCamera::CCameraPostImageCaptureControl::TBufferState bufferState =
2030 CCamera::CCameraPostImageCaptureControl::EBufferNotPresent;
2031 TRAP(err, postImgCapt->GetBufferStateL(bufferState));
2032 if(err != KErrNotSupported)
2034 INFO_PRINTF1(_L("GetBufferStateL for post image capture object unexpected!"));
2038 INFO_PRINTF1(_L("GetImageBufferL for post imgCapt object for Image Capture"));
2039 MCameraImageBuffer* cameraImageBuffer = NULL;
2040 TRAP(err, postImgCapt->GetImageBufferL(*cameraImageBuffer));
2041 if(err != KErrNotSupported)
2043 INFO_PRINTF1(_L("GetImageBufferL for post image capture object unexpected!"));
2047 INFO_PRINTF1(_L("CancelImage for post imgCapt object for Image Capture"));
2048 postImgCapt->CancelImage();
2051 CheckCaptureCompletion(captImg, result);
2053 //perform operations on image capture
2054 INFO_PRINTF1(_L("GetNumImagesExposedL for Image Capture"));
2055 TUint numImagesExposed = 0;
2056 TRAP(err, imageCapture->GetNumImagesExposedL(numImagesExposed));
2057 if(err != KErrNotSupported)
2059 INFO_PRINTF1(_L("GetNumImagesExposedL for Image Capture unexpected!"));
2063 INFO_PRINTF1(_L("GetNumTotalImagesL for Image Capture"));
2064 TRAP(err, imageCapture->GetNumTotalImagesL(numImagesExposed));
2067 INFO_PRINTF1(_L("GetNumTotalImagesL for Image Capture unexpected!"));
2071 INFO_PRINTF1(_L("SetCaptureImagePriorityL for Image Capture"));
2072 TECamImagePriority imagePriority = EECamImagePriorityLow;
2073 TRAP(err, imageCapture->SetCaptureImagePriorityL(imagePriority));
2074 if(err != KErrNotSupported)
2076 INFO_PRINTF1(_L("SetCaptureImagePriorityL for Image Capture unexpected!"));
2080 INFO_PRINTF1(_L("GetCaptureImagePriorityL for Image Capture"));
2081 TRAP(err, imageCapture->GetCaptureImagePriorityL(imagePriority));
2082 if(err != KErrNotSupported)
2084 INFO_PRINTF1(_L("GetCaptureImagePriorityL for Image Capture unexpected!"));
2088 INFO_PRINTF1(_L("PauseProcessing for Image Capture"));
2089 imageCapture->PauseProcessing(0);
2091 INFO_PRINTF1(_L("ResumeProcessingL for Image Capture"));
2092 TRAP(err, imageCapture->ResumeProcessingL(0));
2093 if(err != KErrNotSupported)
2095 INFO_PRINTF1(_L("ResumeProcessingL for Image Capture unexpected!"));
2099 INFO_PRINTF1(_L("CancelCaptureImage for Image Capture"));
2100 imageCapture->CancelCaptureImage();
2102 //start histogram for image capture
2103 INFO_PRINTF1(_L("StartHistogram for Image Capture"));
2104 histogram_IC->StartHistogram();
2105 CCamera::CCameraImageCapture* camImgCapture=NULL;
2106 TPostCaptureControlId postCaptCtrlId = 0;
2107 CheckCaptureNotification(camImgCapture, postCaptCtrlId, result);
2108 if(camImgCapture == NULL || postCaptCtrlId != postCaptureControlId)
2110 INFO_PRINTF1(_L("StartHistogram for Histogram for Image Capture unexpected!"));
2114 INFO_PRINTF1(_L("StopHistogram for histogram for Image Capture"));
2115 histogram_IC->StopHistogram();
2117 //start snapshot for image capture
2118 INFO_PRINTF1(_L("EnableSnapshotL for snapshot for Image Capture"));
2119 TRAP(err,snapshot_IC->EnableSnapshotL());
2122 INFO_PRINTF1(_L("EnableSnapshotL for snapshot for Image Capture: unexpected result!"));
2125 camImgCapture = NULL;
2127 CheckCaptureNotification(camImgCapture, postCaptCtrlId, result);
2128 if(camImgCapture == NULL || postCaptCtrlId != postCaptureControlId)
2130 INFO_PRINTF1(_L("EnableSnapshotL for snapshot for Image Capture unexpected!"));
2134 //start histogram for snapshot for image capture
2135 INFO_PRINTF1(_L("StartHistogram for snapshot for Image Capture"));
2136 histogram_snapshot_IC->StartHistogram();
2139 CheckCaptureNotification(camImgCapture, postCaptCtrlId, result);
2140 if(camImgCapture == NULL || postCaptCtrlId != postCaptureControlId)
2142 INFO_PRINTF1(_L("StartHistogram for Histogram for snapshot for Image Capture unexpected!"));
2146 INFO_PRINTF1(_L("StopHistogram for histogram for snapshot for Image Capture"));
2147 histogram_snapshot_IC->StopHistogram();
2150 INFO_PRINTF1(_L("DisableSnapshotL for snapshot for Image Capture"));
2151 TRAP(err,snapshot_IC->DisableSnapshotL());
2154 INFO_PRINTF1(_L("DisableSnapshotL for snapshot for Image Capture: unexpected result!"));
2158 CleanupStack::PopAndDestroy(postImgCapt);
2159 CleanupStack::PopAndDestroy(histogram_snapshot_IC);
2160 CleanupStack::PopAndDestroy(snapshot_IC);
2161 CleanupStack::PopAndDestroy(impProc);
2162 CleanupStack::PopAndDestroy(histogram_IC);
2163 CleanupStack::PopAndDestroy(imageCapture);
2165 CleanupStack::PopAndDestroy(preImgCapture);
2169 INFO_PRINTF1(_L("CCameraPreImageCaptureControl object was not created using NewL"));
2172 CleanupStack::PopAndDestroy(camera);
2176 INFO_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
2184 /*------------------------------------------------------
2185 Video Capture Control : RECamVideoCaptureControlTest
2186 *------------------------------------------------------*/
2187 RECamVideoCaptureControlTest* RECamVideoCaptureControlTest::NewL(const TDesC& aTestStep)
2189 RECamVideoCaptureControlTest* self = new (ELeave) RECamVideoCaptureControlTest(aTestStep);
2193 RECamVideoCaptureControlTest::RECamVideoCaptureControlTest(const TDesC& aTestStep)
2195 iTestStepName.Copy(aTestStep);
2198 TVerdict RECamVideoCaptureControlTest::DoTestStepL()
2200 if(!iTestStepName.Compare(_L("MM-ECM-ADV-U-056-HP")))
2202 return DoTestStep_56L();
2204 return EInconclusive;
2207 TVerdict RECamVideoCaptureControlTest::DoTestStep_56L()
2209 TVerdict verdict = EFail;
2210 INFO_PRINTF1(_L("Alloc test"));
2219 INFO_PRINTF2(_L("Fail count = %d"), i);
2222 __UHEAP_SETFAIL(RHeap::EFailNext, i);
2224 TRAP(err, verdict = DoVideoCaptureTestStepL());
2226 TAny* testAlloc = User::Alloc(1);
2227 TBool heapTestingComplete = (testAlloc == NULL) && (err==KErrNone);
2228 User::Free(testAlloc);
2233 if ((err != KErrNoMemory ) || heapTestingComplete)
2235 INFO_PRINTF4(_L("err = %d, verdict = %d, Fail count = %d"), err, verdict, i);
2236 INFO_PRINTF1(_L("Alloc testing completed successfully"));
2244 TVerdict RECamVideoCaptureControlTest::DoVideoCaptureTestStepL()
2246 TVerdict result = EPass;
2247 CCamera* camera = NULL;
2249 MCaptureVideoObserver* videoCaptureObserver = NULL;
2251 TInt error = KErrNone;
2252 CCamera::CCameraVideoCaptureControl* videoCapture = NULL;
2256 MCameraObserver* observer=NULL;
2257 INFO_PRINTF1(_L("Create camera using Camera::NewL() and MCameraObserver"));
2258 TRAP(error, camera = CCamera::NewL(*observer, 0));
2259 if (error==KErrNone)
2261 CleanupStack::PushL(camera);
2262 INFO_PRINTF1(_L("Create VideoCaptureControl from CCamera object"));
2264 TRAP(error, videoCapture = CCamera::CCameraVideoCaptureControl::NewL(*camera, *videoCaptureObserver));
2265 if (error==KErrExtensionNotSupported)
2267 INFO_PRINTF1(_L("CCameraVideoCaptureControl object creation using old Observer failed with correct error"));
2271 INFO_PRINTF1(_L("CCameraVideoCaptureControl object creation using old Observer gave unexpected result"));
2274 CleanupStack::PopAndDestroy(camera);
2278 INFO_PRINTF2(_L("Unexpected %d return from CCamera::NewL()"), error);
2280 User::Leave(KErrNoMemory);
2284 // using observer2 with NewL
2285 MCameraObserver2* observer2 = NULL;
2287 INFO_PRINTF1(_L("Create camera using Camera::NewL() and MCameraObserver2"));
2288 TRAP(error, camera = CCamera::NewL(*observer2, 0,0));
2289 if (error==KErrNone)
2291 CleanupStack::PushL(camera);
2292 INFO_PRINTF1(_L("Create VideoCaptureControl from CCamera object"));
2294 TRAP(error, videoCapture = CCamera::CCameraVideoCaptureControl::NewL(*camera, *videoCaptureObserver));
2295 if (error==KErrExtensionNotSupported)
2297 INFO_PRINTF1(_L("CCameraVideoCaptureControl object creation using Observer2 with NewL failed with correct error"));
2301 INFO_PRINTF1(_L("CCameraVideoCaptureControl object creation using Observer2 with NewL gave unexpected result"));
2304 CleanupStack::PopAndDestroy(camera);
2308 INFO_PRINTF2(_L("Unexpected %d return from CCamera::NewL()"), error);
2310 User::Leave(KErrNoMemory);
2315 // create video capture control object using New2L
2317 INFO_PRINTF1(_L("Create camera using Camera::New2L() and MCameraObserver2"));
2319 TRAP(error, camera = CCamera::New2L(*observer2, 0,0));
2320 if (error==KErrNone)
2322 CleanupStack::PushL(camera);
2323 INFO_PRINTF1(_L("KErrNone return from CCamera::New2L()"));
2324 TRAP(error, videoCapture = CCamera::CCameraVideoCaptureControl::NewL(*camera, *videoCaptureObserver));
2326 if (error==KErrNone)
2328 CleanupStack::PushL(videoCapture);
2329 INFO_PRINTF1(_L("CCameraVideoCaptureControl object was created using NewL"));
2330 CleanupStack::PopAndDestroy(videoCapture);
2334 INFO_PRINTF1(_L("CCameraVideoCaptureControl object was not created using NewL"));
2336 User::Leave(KErrNoMemory);
2338 CleanupStack::PopAndDestroy(camera);
2342 INFO_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
2344 User::Leave(KErrNoMemory);
2351 /*--------------------------------------------------------------
2352 Video Capture Control : RECamVideoCaptureNotificationTest
2353 *--------------------------------------------------------------*/
2354 RECamVideoCaptureNotificationTest* RECamVideoCaptureNotificationTest::NewL(TBool aAllocTest)
2356 RECamVideoCaptureNotificationTest* self = new (ELeave) RECamVideoCaptureNotificationTest(aAllocTest);
2357 CleanupStack::PushL(self);
2359 CleanupStack::Pop(self);
2363 void RECamVideoCaptureNotificationTest::ConstructL()
2367 RECamVideoCaptureNotificationTest::RECamVideoCaptureNotificationTest(TBool /*aAllocTest*/)
2369 iTestStepName = _L("MM-ECM-ADV-U-057-HP");
2372 void RECamVideoCaptureNotificationTest::VideoBufferReady(MCameraBuffer2* /*aVideoBuffer*/, TInt aErrorCode)
2374 iError = aErrorCode;
2377 void RECamVideoCaptureNotificationTest::ClientSnapshotReady(MCameraBuffer2* /*aSnapshotBuffer*/, TInt aErrorCode)
2379 iError = aErrorCode;
2382 void RECamVideoCaptureNotificationTest::ClientHistogramReady(MHistogramV2Buffer* /*aClientHistogramBuffer*/, TInt aErrorCode)
2384 iError = aErrorCode;
2387 void RECamVideoCaptureNotificationTest::ImageProcessingFailed(TInt aErrorCode)
2389 iError = aErrorCode;
2392 void RECamVideoCaptureNotificationTest::DirectVideoCaptureFailed(TInt aErrorCode)
2394 iError = aErrorCode;
2397 TInt RECamVideoCaptureNotificationTest::CustomInterface(TUid /*aInterface*/, TAny*& /*aPtrInterface*/)
2402 void RECamVideoCaptureNotificationTest::CheckVideoCaptureNegNotification(TInt aErrorCode, TVerdict& aResult)
2404 INFO_PRINTF3(_L("Expected Video Capture Control Error %d, received Error %d."), aErrorCode, iError);
2405 if (iError != aErrorCode)
2411 TVerdict RECamVideoCaptureNotificationTest::DoTestStepL()
2413 TVerdict result = EPass;
2414 CCamera* camera = NULL;
2416 TInt error = KErrNone;
2417 CCamera::CCameraVideoCaptureControl* videocapture = NULL;
2419 // create video capture control object using New2L
2421 INFO_PRINTF1(_L("Create camera using Camera::New2L() and MCameraObserver2"));
2423 TRAP(error, camera = CCamera::New2L(*this, 0, 0));
2425 if (error==KErrNone)
2427 CleanupStack::PushL(camera);
2428 INFO_PRINTF1(_L("KErrNone return from CCamera::New2L()"));
2429 TRAP(error, videocapture = CCamera::CCameraVideoCaptureControl::NewL(*camera, *this));
2431 if (error==KErrNone)
2433 CleanupStack::PushL(videocapture);
2434 INFO_PRINTF1(_L("CCameraVideoCaptureControl object was created using NewL"));
2435 //Test Video Capture APIs
2436 INFO_PRINTF1(_L("Create Histogram for Direct ViewFinder"));
2437 CCamera::CCameraV2Histogram* histogram_VC = videocapture->CreateHistogramHandleL();
2440 INFO_PRINTF1(_L("Histogram creation for Video Capture Control unsuccessful"));
2444 CleanupStack::PushL(histogram_VC);
2446 INFO_PRINTF1(_L("Create ImageProcessing for Video Capture Control "));
2448 TRAPD(err, videocapture->GetTransformationHandleL());
2449 if(err != KErrNotSupported)
2451 INFO_PRINTF1(_L("ImageProcessing creation for Video Capture Control : unexpected result!"));
2455 INFO_PRINTF1(_L("Create snapshot for Video Capture Control "));
2456 TInt viewfinderID=0;
2457 CCamera::CCameraSnapshot* snapshot_VC = videocapture->GetSnapshotHandleL(viewfinderID);
2460 INFO_PRINTF1(_L("snapshot creation for Video Capture Control : unexpected result!"));
2464 CleanupStack::PushL(snapshot_VC);
2466 //set properties for video capture
2467 INFO_PRINTF1(_L("GetVideoFormatsSupportedL for Video Capture Control"));
2468 TUint videoFormatsSupported=0;
2469 TSize size(320,240);
2470 TRAP(err,videocapture->GetVideoFormatsSupportedL(videoFormatsSupported, size));
2473 INFO_PRINTF1(_L("GetVideoFormatsSupportedL for Video Capture Control: unexpected result!"));
2477 if(videoFormatsSupported == 0)
2479 INFO_PRINTF1(_L(" Number of VideoFormats Supported for Video Capture Control: unexpected result!"));
2482 INFO_PRINTF1(_L("GetPixelAspectsSupportedL for Video Capture Control"));
2483 TUint pixelAspectsSupported=0;
2484 CCamera::TFormat format = CCamera::EFormatFbsBitmapColor16M;
2485 TRAP(err,videocapture->GetPixelAspectsSupportedL(pixelAspectsSupported, format, size));
2488 INFO_PRINTF1(_L("GetPixelAspectsSupportedL for Video Capture Control: unexpected result!"));
2492 if(pixelAspectsSupported == 0)
2494 INFO_PRINTF1(_L(" Number of PixelAspects Supported for Video Capture Control: unexpected result!"));
2497 INFO_PRINTF1(_L("GetEmbeddedStillCaptureSupportInfoL for Video Capture Control"));
2498 TInt supportedEmbeddedStillCaptureTypes=0;
2499 TRAP(err,videocapture->GetEmbeddedStillCaptureSupportInfoL(supportedEmbeddedStillCaptureTypes));
2502 INFO_PRINTF1(_L("GetEmbeddedStillCaptureSupportInfoL for Video Capture Control: unexpected result!"));
2506 if(supportedEmbeddedStillCaptureTypes != 0)
2508 INFO_PRINTF1(_L(" Supported Types of Embedded Still Capture for Video Capture Control: unexpected result!"));
2511 INFO_PRINTF1(_L("PrepareVideoCapture for Video Capture Control"));
2512 iInputEventUid = KUidECamEventVideoCaptureControlPrepareComplete;
2513 CCamera::CCameraVideoCaptureControl::TPrepareVideoParameters prepareVideoParameters;
2515 prepareVideoParameters.SetEmbeddedStillCaptureState(ETrue);
2517 if(!prepareVideoParameters.IsEmbeddedStillCaptureEnabled())
2519 INFO_PRINTF1(_L("IsEmbeddedStillCaptureEnabled for Video Capture Control: unexpected result!"));
2523 prepareVideoParameters.SetEmbeddedStillCaptureState(EFalse);
2525 if(prepareVideoParameters.IsEmbeddedStillCaptureEnabled() != EFalse)
2527 INFO_PRINTF1(_L("IsEmbeddedStillCaptureEnabled for Video Capture Control: unexpected result!"));
2531 videocapture->PrepareVideoCapture(prepareVideoParameters);
2533 CheckNotification(iInputEventUid, result);
2535 INFO_PRINTF1(_L("GetRangeAffectedSettingsL for Video Capture Control"));
2536 RArray<TUid> affectedSettings;
2538 TRAP(err,videocapture->GetRangeAffectedSettingsL(affectedSettings));
2541 INFO_PRINTF1(_L("GetRangeAffectedSettingsL for Video Capture Control: unexpected result!"));
2545 if(affectedSettings.Count() != 0)
2547 INFO_PRINTF1(_L("Number of RangeAffectedSettingsL for Video Capture Control: unexpected result!"));
2551 INFO_PRINTF1(_L("GetValueAffectedSettingsL for Video Capture Control"));
2552 TRAP(err,videocapture->GetValueAffectedSettingsL(affectedSettings));
2555 INFO_PRINTF1(_L("GetValueAffectedSettingsL for Video Capture Control: unexpected result!"));
2559 if(affectedSettings.Count() != 0)
2561 INFO_PRINTF1(_L("Number of ValueAffectedSettingsL for Video Capture Control: unexpected result!"));
2565 INFO_PRINTF1(_L("GetDisabledSettingsL for Video Capture Control"));
2566 TRAP(err,videocapture->GetDisabledSettingsL(affectedSettings));
2569 INFO_PRINTF1(_L("GetDisabledSettingsL for Video Capture Control: unexpected result!"));
2573 if(affectedSettings.Count() != 0)
2575 INFO_PRINTF1(_L("Number of DisabledSettingsL for Video Capture Control: unexpected result!"));
2579 INFO_PRINTF1(_L("ReleaseVideoResource for Video Capture Control"));
2580 videocapture->ReleaseVideoResource();
2582 INFO_PRINTF1(_L("GetFadingEffectStateL for Video Capture Control"));
2583 CCamera::CCameraVideoCaptureControl::TFadingEffectState fadingEffectState =
2584 CCamera::CCameraVideoCaptureControl::EFadingEffectDisabled;
2585 TRAP(err,videocapture->GetFadingEffectStateL(fadingEffectState));
2586 if(err != KErrNotSupported)
2588 INFO_PRINTF1(_L("GetFadingEffectStateL for Video Capture Control: unexpected result!"));
2592 INFO_PRINTF1(_L("SetFadingEffectState for Video Capture Control"));
2593 iInputEventUid = KUidECamEventVideoCaptureControlFadingEffect;
2594 videocapture->SetFadingEffectState(CCamera::CCameraVideoCaptureControl::EFadingEffectEnabled);
2595 CheckNotificationNeg(iInputEventUid, result);
2597 //set properties for histogram (for video capture)
2598 TUint supportedHistogramType=0;
2599 histogram_VC->GetSupportedHistogramsL(supportedHistogramType);
2600 if(supportedHistogramType!=0)
2602 INFO_PRINTF1(_L("unexpected GetSupportedHistogramsL"));
2606 INFO_PRINTF1(_L("GetDirectHistogramSupportInfoL for Histogram for Video Capture"));
2607 TBool directHistogramSupported = EFalse;
2608 TRAP(err,histogram_VC->GetDirectHistogramSupportInfoL(directHistogramSupported));
2609 if(err != KErrNotSupported)
2611 INFO_PRINTF1(_L("GetDirectHistogramSupportInfoL for Histogram for Video Capture: unexpected result!"));
2615 INFO_PRINTF1(_L("PrepareClientHistogramL for Histogram for Video Capture"));
2616 CCamera::CCameraV2Histogram::THistogramType histogramType = CCamera::CCameraV2Histogram::EHistNone;
2617 TRAP(err,histogram_VC->PrepareClientHistogramL(histogramType));
2618 if(err != KErrNotSupported)
2620 INFO_PRINTF1(_L("PrepareClientHistogramL for Histogram for Video Capture: unexpected result!"));
2624 INFO_PRINTF1(_L("PrepareDirectHistogramL for Histogram for Video Capture"));
2625 CCamera::CCameraV2Histogram::TDirectHistogramParameters histogramParameters;
2626 TRAP(err,histogram_VC->PrepareDirectHistogramL(histogramParameters));
2627 if(err != KErrNotSupported)
2629 INFO_PRINTF1(_L("PrepareDirectHistogramL for Histogram for Video Capture: unexpected result!"));
2633 INFO_PRINTF1(_L("UpdateDirectHistogramPropertiesL for Histogram for Video Capture"));
2634 TRAP(err,histogram_VC->UpdateDirectHistogramPropertiesL(histogramParameters));
2635 if(err != KErrNotSupported)
2637 INFO_PRINTF1(_L("UpdateDirectHistogramPropertiesL for Histogram for Video Capture: unexpected result!"));
2641 INFO_PRINTF1(_L("GetDirectHistogramPropertiesL for Histogram for Video Capture"));
2642 TRAP(err,histogram_VC->GetDirectHistogramPropertiesL(histogramParameters));
2643 if(err != KErrNotSupported)
2645 INFO_PRINTF1(_L("GetDirectHistogramPropertiesL for Histogram for Video Capture: unexpected result!"));
2649 INFO_PRINTF1(_L("GetHistogramStateL for Histogram for Video Capture"));
2650 TBool histogramActive = EFalse;
2651 TRAP(err,histogram_VC->GetHistogramStateL(histogramActive));
2652 if(err != KErrNotSupported)
2654 INFO_PRINTF1(_L("GetHistogramStateL for Histogram for Video Capture: unexpected result!"));
2658 //set properties for snapshot (for video capture)
2659 CCamera::CCameraSnapshot::TSnapshotParameters snapshotParam;
2661 INFO_PRINTF1(_L("SetAspectRatioState for Snapshot for Video Capture"));
2662 snapshotParam.SetAspectRatioState(ETrue);
2663 TBool aspectRatioState = snapshotParam.IsAspectRatioMaintained();
2664 if(!aspectRatioState)
2666 INFO_PRINTF1(_L("AspectRatioState for Snapshot for Video Capture: unexpected result!"));
2669 snapshotParam.SetAspectRatioState(EFalse);
2670 aspectRatioState = snapshotParam.IsAspectRatioMaintained();
2671 if(aspectRatioState != EFalse)
2673 INFO_PRINTF1(_L("AspectRatioState for Snapshot for Video Capture: unexpected result!"));
2677 INFO_PRINTF1(_L("PrepareSnapshotL for Snapshot for Video Capture"));
2678 TRAP(err,snapshot_VC->PrepareSnapshotL(snapshotParam));
2681 INFO_PRINTF1(_L("PrepareSnapshotL for Snapshot for Video Capture: unexpected result!"));
2685 INFO_PRINTF1(_L("GetSnapshotParametersL for Snapshot for Video Capture"));
2686 TRAP(err,snapshot_VC->GetSnapshotParametersL(snapshotParam));
2689 INFO_PRINTF1(_L("GetSnapshotParametersL for Snapshot for Video Capture: unexpected result!"));
2693 INFO_PRINTF1(_L("SetSnapshotParametersL for Snapshot for Video Capture"));
2694 TRAP(err,snapshot_VC->SetSnapshotParametersL(snapshotParam));
2697 INFO_PRINTF1(_L("SetSnapshotParametersL for Snapshot for Video Capture: unexpected result!"));
2701 INFO_PRINTF1(_L("SelectSnapshotVideoFramesL for Snapshot for Video Capture"));
2702 CCamera::CCameraSnapshot::TSnapshotVideoFrames snapshotVideoFrames = CCamera::CCameraSnapshot::ESnapshotVideoFirstFrame;
2703 TRAP(err,snapshot_VC->SelectSnapshotVideoFramesL(snapshotVideoFrames));
2704 if(err != KErrNotSupported)
2706 INFO_PRINTF1(_L("SelectSnapshotVideoFramesL for Snapshot for Video Capture: unexpected result!"));
2710 //Start video capture and other child objects
2711 INFO_PRINTF1(_L("StartVideoCaptureL for Video Capture"));
2712 TRAP(err,videocapture->StartVideoCaptureL());
2715 INFO_PRINTF1(_L("StartVideoCaptureL for Video Capture: unexpected result!"));
2719 CheckVideoCaptureNegNotification(KErrNotSupported, result);
2721 INFO_PRINTF1(_L("StartHistogram for Video Capture"));
2722 histogram_VC->StartHistogram();
2723 CheckVideoCaptureNegNotification(KErrNotSupported, result);
2725 INFO_PRINTF1(_L("StopHistogram for Video Capture"));
2726 histogram_VC->StopHistogram();
2728 INFO_PRINTF1(_L("EnableSnapshotL for snapshot for Video Capture"));
2729 TRAP(err,snapshot_VC->EnableSnapshotL());
2732 INFO_PRINTF1(_L("EnableSnapshotL for snapshot for Video Capture: unexpected result!"));
2735 CheckVideoCaptureNegNotification(KErrNotSupported, result);
2737 INFO_PRINTF1(_L("GetSnapshotStatusL for snapshot for Video Capture"));
2738 CCamera::CCameraSnapshot::TSnapshotState snapshotState = CCamera::CCameraSnapshot::ESnapshotInactive;
2739 TRAP(err,snapshot_VC->GetSnapshotStatusL(snapshotState));
2740 if(err != KErrNotSupported)
2742 INFO_PRINTF1(_L("GetSnapshotStatusL for snapshot for Video Capture: unexpected result!"));
2746 INFO_PRINTF1(_L("DisableSnapshotL for snapshot for Video Capture"));
2747 TRAP(err,snapshot_VC->DisableSnapshotL());
2750 INFO_PRINTF1(_L("DisableSnapshotL for snapshot for Video Capture: unexpected result!"));
2754 INFO_PRINTF1(_L("PauseVideoCapture for Video Capture"));
2755 videocapture->PauseVideoCapture();
2757 INFO_PRINTF1(_L("ResumeVideoCaptureL for Video Capture"));
2758 TRAP(err,videocapture->ResumeVideoCaptureL());
2759 if(err != KErrNotSupported)
2761 INFO_PRINTF1(_L("ResumeVideoCaptureL for Video Capture: unexpected result!"));
2765 INFO_PRINTF1(_L("GetVideoCaptureStateL for Video Capture"));
2766 CCamera::CCameraVideoCaptureControl::TVideoCaptureState videoCaptureState =
2767 CCamera::CCameraVideoCaptureControl::EVideoCaptureInActive;
2768 TRAP(err,videocapture->GetVideoCaptureStateL(videoCaptureState));
2769 if(err != KErrNotSupported)
2771 INFO_PRINTF1(_L("GetVideoCaptureStateL for Video Capture: unexpected result!"));
2775 INFO_PRINTF1(_L("StopVideoCapture for Video Capture"));
2776 videocapture->StopVideoCapture();
2778 //Start Direct video capture and other child objects
2779 TInt supportedDVCType = -1;
2780 INFO_PRINTF1(_L("Check Direct Video Capture Support Info"));
2781 TRAP(err,videocapture->GetVideoCaptureSupportInfoL(supportedDVCType));
2784 INFO_PRINTF1(_L("GetVideoCaptureSupportInfoL for Video Capture: unexpected result!"));
2788 if(supportedDVCType != KSupportedDirectVCType)
2790 INFO_PRINTF1(_L("GetVideoCaptureSupportInfoL for Video Capture: unexpected result!"));
2794 INFO_PRINTF1(_L("Test Set Client Video Capture in PrepareVideoParameters"));
2796 prepareVideoParameters.SetVideoCaptureType(CCamera::CCameraVideoCaptureControl::EClientVideoCapture);
2798 if(CCamera::CCameraVideoCaptureControl::EClientVideoCapture != prepareVideoParameters.VideoCaptureType())
2800 INFO_PRINTF1(_L("iVideoCaptureType for TPrepareVideoParameters: unexpected result!"));
2805 INFO_PRINTF1(_L("Set Video Capture in PrepareVideoParameters"));
2807 prepareVideoParameters.SetVideoCaptureType(CCamera::CCameraVideoCaptureControl::EDirectVideoCapture);
2809 if(CCamera::CCameraVideoCaptureControl::EDirectVideoCapture != prepareVideoParameters.VideoCaptureType())
2811 INFO_PRINTF1(_L("iVideoCaptureType for TPrepareVideoParameters: unexpected result!"));
2815 prepareVideoParameters.iFormat = CCamera::EFormatEncodedH264;
2816 prepareVideoParameters.iPixelAspectRatio = CCamera::CCameraAdvancedSettings::EEPixelAspect40To33;
2818 iInputEventUid = KUidECamEventVideoCaptureControlPrepareComplete;
2819 videocapture->PrepareVideoCapture(prepareVideoParameters);
2820 CheckNotification(iInputEventUid, result);
2822 INFO_PRINTF1(_L("StartVideoCaptureL for Direct Video Capture"));
2823 TRAP(err,videocapture->StartVideoCaptureL());
2826 INFO_PRINTF1(_L("StartVideoCaptureL for Video Capture: unexpected result!"));
2830 CheckVideoCaptureNegNotification(KErrNotSupported, result);
2832 INFO_PRINTF1(_L("StopVideoCapture for Direct Video Capture"));
2833 videocapture->StopVideoCapture();
2835 INFO_PRINTF1(_L("GetPrepareVideoParameters for Direct Video Capture"));
2836 CCamera::CCameraVideoCaptureControl::TPrepareVideoParameters retrievedVideoParam;
2837 TRAP(err,videocapture->GetPrepareVideoParametersL(retrievedVideoParam));
2840 INFO_PRINTF1(_L("GetPrepareVideoParametersL for Video Capture: unexpected result!"));
2844 if(CCamera::EFormatEncodedH264 != retrievedVideoParam.iFormat)
2846 INFO_PRINTF1(_L("GetPrepareVideoParametersL for Video Capture: unexpected result!"));
2850 INFO_PRINTF2(_L("retrievedVideoParam.iFormat: %d"),retrievedVideoParam.iFormat);
2851 INFO_PRINTF2(_L("retrievedVideoParam.iPixelAspectRatio: %d"),retrievedVideoParam.iPixelAspectRatio);
2854 CleanupStack::PopAndDestroy(snapshot_VC);
2855 CleanupStack::PopAndDestroy(histogram_VC);
2856 CleanupStack::PopAndDestroy(videocapture);
2860 INFO_PRINTF1(_L("CCameraVideoCaptureControl object not created"));
2863 CleanupStack::PopAndDestroy(camera);
2867 INFO_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);