os/mm/imagingandcamerafws/cameraunittest/src/TSU_ECM_ADV/ECamImageProcessingTest.cpp
Update contrib.
2 // ECamImageProcessingTest.cpp
4 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
5 // All rights reserved.
6 // This component and the accompanying materials are made available
7 // under the terms of "Eclipse Public License v1.0"
8 // which accompanies this distribution, and is available
9 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
11 // Initial Contributors:
12 // Nokia Corporation - initial contribution.
19 #include "ECamImageProcessingTest.h"
20 #include <ecamadvsettings.h>
21 #include <ecam/ecamplugin.h>
22 #include <ecamuids.hrh>
23 #include <ecom/ecomresolverparams.h>
24 #include "ECamUnitTestPluginUids.hrh"
25 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
26 #include <ecamimageprocessingconst.h>
31 //const TRect KRect1(100, 50, 600, 200);
32 const TInt KValue = 100;
33 const TInt KBaselinedEffects = 0x000001FF;
35 // RECamImageProcessingTest
38 RECamImageProcessingTest* RECamImageProcessingTest::NewL(TBool aAllocTest)
40 RECamImageProcessingTest* self = new (ELeave) RECamImageProcessingTest(aAllocTest);
44 RECamImageProcessingTest::RECamImageProcessingTest(TBool /*aAllocTest*/)
46 iTestStepName = _L("MM-ECM-ADV-U-007-HP");
49 TVerdict RECamImageProcessingTest::DoTestStepL()
51 TVerdict verdict = EFail;
52 INFO_PRINTF1(_L("Alloc test"));
61 INFO_PRINTF2(_L("Fail count = %d"), i);
64 __UHEAP_SETFAIL(RHeap::EFailNext, i);
66 TRAP(err, verdict = DoImageProcessingTestStepL());
68 TAny* testAlloc = User::Alloc(1);
69 TBool heapTestingComplete = (testAlloc == NULL) && (err==KErrNone);
70 User::Free(testAlloc);
75 if ((err != KErrNoMemory ) || heapTestingComplete)
77 INFO_PRINTF4(_L("err = %d, verdict = %d, Fail count = %d"), err, verdict, i);
78 INFO_PRINTF1(_L("Alloc testing completed successfully"));
86 TVerdict RECamImageProcessingTest::DoImageProcessingTestStepL()
88 TVerdict result = EPass;
89 CCamera* camera = NULL;
91 TInt error = KErrNone;
92 CCamera::CCameraImageProcessing* imageprocess = NULL;
95 MCameraObserver2* observer2 = NULL;
98 INFO_PRINTF1(_L("Create camera using Camera::New2L() and MCameraObserver2"));
100 TRAP(error, camera = CCamera::New2L(*observer2, 0,0));
104 CleanupStack::PushL(camera);
105 INFO_PRINTF1(_L("KErrNone return from CCamera::New2L()"));
106 imageprocess = static_cast<CCamera::CCameraImageProcessing*> (camera->CustomInterface(KECamImageProcessingUid));
107 if (imageprocess!= NULL)
109 CleanupStack::PushL(imageprocess);
110 INFO_PRINTF1(_L("CCameraImageProcessing object was created"));
111 CleanupStack::PopAndDestroy(imageprocess);
116 User::Leave(KErrNoMemory);
118 CleanupStack::PopAndDestroy(camera);
122 INFO_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
124 User::Leave(KErrNoMemory);
128 // create a imageprocessing object using New2L
130 INFO_PRINTF1(_L("Create camera using Camera::New2L() and MCameraObserver2"));
132 TRAP(error, camera = CCamera::New2L(*observer2, 0,0));
136 CleanupStack::PushL(camera);
137 INFO_PRINTF1(_L("KErrNone return from CCamera::New2L()"));
138 TRAP(error, imageprocess = CCamera::CCameraImageProcessing::NewL(*camera));
142 CleanupStack::PushL(imageprocess);
143 INFO_PRINTF1(_L("CCameraImageProcessing object was created using NewL"));
144 CleanupStack::PopAndDestroy(imageprocess);
148 INFO_PRINTF1(_L("CCameraImageProcessing object was not created using NewL"));
150 User::Leave(KErrNoMemory);
152 CleanupStack::PopAndDestroy(camera);
156 INFO_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
158 User::Leave(KErrNoMemory);
166 // RECamImageProcDefaultsTest //
169 RECamImageProcDefaultsTest* RECamImageProcDefaultsTest::NewL(TBool aAllocTest)
171 RECamImageProcDefaultsTest* self = new (ELeave) RECamImageProcDefaultsTest(aAllocTest);
175 RECamImageProcDefaultsTest::RECamImageProcDefaultsTest(TBool)
177 iTestStepName = _L("MM-ECM-ADV-U-012-HP");
180 TBool RECamImageProcDefaultsTest::CompareUidArrays(RArray<TUid>& firstArray, RArray<TUid>& secondArray)
182 TBool result = ETrue;
184 if (firstArray.Count() != secondArray.Count())
190 for (TInt expected = 0; expected < firstArray.Count(); expected++)
193 for (TInt actual = 0; actual < secondArray.Count(); actual++)
195 if (secondArray[actual] == firstArray[expected])
206 TVerdict RECamImageProcDefaultsTest::DoTestStepL()
208 TVerdict result = EPass;
209 CCamera* camera = NULL;
211 TInt error = KErrNone;
212 CCamera::CCameraImageProcessing* imageprocess = NULL;
215 INFO_PRINTF1(_L("Create camera using Camera::New2L() and MCameraObserver2"));
217 TRAP(error, camera = CCamera::New2L(*this,0,0));
221 CleanupStack::PushL(camera);
222 INFO_PRINTF1(_L("KErrNone return from CCamera::New2L()"));
223 imageprocess = static_cast<CCamera::CCameraImageProcessing*> (camera->CustomInterface(KECamImageProcessingUid));
224 if (imageprocess!= NULL)
226 CleanupStack::PushL(imageprocess);
228 // Supported Transformations
229 RArray<TUid> expectedTransfUids;
230 CleanupClosePushL(expectedTransfUids);
231 expectedTransfUids.Reset();
232 // set the expected UIDS
233 expectedTransfUids.AppendL(KUidECamEventImageProcessingAdjustBrightness);
234 expectedTransfUids.AppendL(KUidECamEventImageProcessingAdjustContrast);
235 expectedTransfUids.AppendL(KUidECamEventImageProcessingEffect);
236 RArray<TUid> suppTransfUids;
237 CleanupClosePushL(suppTransfUids);
238 imageprocess->GetSupportedTransformationsL(suppTransfUids);
239 if (CompareUidArrays(expectedTransfUids, suppTransfUids) == EFalse)
241 INFO_PRINTF1(_L("GetSupportedTransformationsL failed"));
244 expectedTransfUids.Reset();
245 suppTransfUids.Reset();
246 CleanupStack::PopAndDestroy(2, &expectedTransfUids); //suppTransfUids
248 // Active Transformations
249 RArray<TUid> expectedActTransfUids;
250 CleanupClosePushL(expectedActTransfUids);
251 expectedActTransfUids.Reset();
252 // set the expected UIDS
253 expectedActTransfUids.AppendL(KUidECamEventImageProcessingAdjustBrightness);
254 expectedActTransfUids.AppendL(KUidECamEventImageProcessingAdjustContrast);
255 expectedActTransfUids.AppendL(KUidECamEventImageProcessingEffect);
256 RArray<TUid> actTransfUids;
257 CleanupClosePushL(actTransfUids);
258 actTransfUids.Reset();
259 imageprocess->GetActiveTransformationsL(actTransfUids);
260 if (CompareUidArrays(expectedActTransfUids, actTransfUids) == EFalse)
262 INFO_PRINTF1(_L("GetActiveTransformationsL failed"));
265 CleanupStack::PopAndDestroy(2, &expectedActTransfUids); //actTransfUids
267 // Set & Get Active Transformation Sequence
268 RArray<TUid> expectedTransfSequence;
269 CleanupClosePushL(expectedTransfSequence);
270 expectedTransfSequence.Reset();
271 expectedTransfSequence.Append(KUidECamEventImageProcessingAdjustBrightness);
273 imageprocess->SetActiveTransformSequenceL(expectedTransfSequence);
275 RArray<TUid> actTransfSequence;
276 CleanupClosePushL(actTransfSequence);
277 actTransfSequence.Reset();
278 imageprocess->GetActiveTransformSequenceL(actTransfSequence);
279 if (CompareUidArrays(expectedTransfSequence, actTransfSequence) == EFalse)
281 INFO_PRINTF1(_L("GetActiveTransformSequenceL failed"));
284 CleanupStack::PopAndDestroy(2, &expectedTransfSequence); //actTransfSequence
286 // Get & Set Transformation
287 TUid iInputEventUid = KUidECamEventImageProcessingAdjustBrightness;
289 imageprocess->SetTransformationValue(iInputEventUid, aSetValue);
291 CheckNotification(iInputEventUid, result);
293 // Check that value has actually changed.
294 TInt aGetValue = imageprocess->TransformationValue(iInputEventUid);
295 if (aSetValue != aGetValue)
297 INFO_PRINTF3(_L("Got wrong TransformationValue set %d, got %d"), aSetValue, aGetValue);
302 INFO_PRINTF2(_L("Transformation value set to %d"), aSetValue);
306 TInt err = imageprocess->GetTransformationValue(iInputEventUid, aGetValue1);
310 INFO_PRINTF2(_L("New method for Getting Transformation value returned error %d"), err);
314 if(aGetValue1 != aGetValue)
316 INFO_PRINTF1(_L("New and old method for Getting Transformation value retrieves wrong/dissimilar values"));
320 //Set Effect Transformation with color swap
321 iInputEventUid = KUidECamEventImageProcessingEffect;
322 RArray<TInt> supportedEffects;
324 TValueInfo info = ENotActive;
325 imageprocess->GetTransformationSupportedValuesL(iInputEventUid, supportedEffects, info);
327 TInt effects = supportedEffects[0];
328 supportedEffects.Close();
330 if(info != EBitField)
332 INFO_PRINTF1(_L("Incorrect TValueInfo provided"));
336 if(effects & CCamera::CCameraImageProcessing::EEffectColorSwap)
338 imageprocess->SetTransformationValue(iInputEventUid, CCamera::CCameraImageProcessing::EEffectColorSwap);
340 CheckNotification(iInputEventUid, result);
343 // Check that value has actually changed.
344 aGetValue = imageprocess->TransformationValue(iInputEventUid);
345 if (aGetValue != static_cast<TInt>(CCamera::CCameraImageProcessing::EEffectColorSwap))
347 INFO_PRINTF1(_L("Got wrong TransformationValue set"));
352 INFO_PRINTF1(_L("Transformation value set to EEffectColorSwap"));
355 TInt concurrentColorSwappingSupported=0;
356 imageprocess->GetConcurrentColorSwappingsSupportedL(concurrentColorSwappingSupported);
358 if(concurrentColorSwappingSupported > 0)
360 TestColorSwapL(imageprocess, result);
363 //Set Effect Transformation with color accent
364 iInputEventUid = iInputEventUid = KUidECamEventImageProcessingEffect;
365 if(effects & CCamera::CCameraImageProcessing::EEffectColorAccent)
367 imageprocess->SetTransformationValue(iInputEventUid, CCamera::CCameraImageProcessing::EEffectColorAccent);
369 CheckNotification(iInputEventUid, result);
372 // Check that value has actually changed.
373 aGetValue = imageprocess->TransformationValue(iInputEventUid);
374 if (aGetValue != static_cast<TInt>(CCamera::CCameraImageProcessing::EEffectColorAccent))
376 INFO_PRINTF1(_L("Got wrong TransformationValue set"));
381 INFO_PRINTF1(_L("Transformation value set to EEffectColorAccent"));
384 TInt concurrentColorAccentSupported=0;
385 imageprocess->GetConcurrentColorAccentSupportedL(concurrentColorAccentSupported);
387 if(concurrentColorAccentSupported > 0)
389 TestColorAccentL(imageprocess, result);
392 // Get & Set Source Rect
393 TRect setRect(100, 50, 600, 200);
395 imageprocess->SetSourceRect(setRect);
396 imageprocess->GetSourceRect(getRect);
397 if (setRect != getRect)
399 INFO_PRINTF1(_L("Did not get the same rect"));
403 CCamera::CCameraImageProcessing::TOrientationReference orientationReference =
404 CCamera::CCameraImageProcessing::EOrientationReferenceCameraSensorOrientation;
405 TUint supportedRelativeRotation=0;
406 TUint supportedRelativeMirroring=0;
407 TUint supportedRelativeFlipping=0;
409 INFO_PRINTF1(_L("GetSupportedRelativeOrientationOptionsL method invocation"));
411 TRAP(err,imageprocess->GetSupportedRelativeOrientationOptionsL(orientationReference,
412 supportedRelativeRotation, supportedRelativeMirroring, supportedRelativeFlipping));
414 if(err!= KErrNotSupported)
416 INFO_PRINTF1(_L("GetSupportedRelativeOrientationOptionsL did not leave with KErrNotSupported"));
420 CCamera::CCameraImageProcessing::TRelativeRotation relativeRotation =
421 CCamera::CCameraImageProcessing::ERelativeRotation0Degrees;
423 CCamera::CCameraImageProcessing::TRelativeMirror relativeMirror =
424 CCamera::CCameraImageProcessing::ERelativeMirrorNone;
426 CCamera::CCameraImageProcessing::TRelativeFlipping relativeFlipping =
427 CCamera::CCameraImageProcessing::ERelativeFlippingNone;
429 INFO_PRINTF1(_L("GetCurrentRelativeOrientationOptionsL method invocation"));
430 TRAP(err,imageprocess->GetCurrentRelativeOrientationOptionsL(orientationReference,
431 relativeRotation, relativeMirror, relativeFlipping));
433 if(err!= KErrNotSupported)
435 INFO_PRINTF1(_L("GetCurrentRelativeOrientationOptionsL did not leave with KErrNotSupported"));
439 INFO_PRINTF1(_L("SetRelativeOrientationOptionsL method invocation"));
440 iInputEventUid = KUidECamEventImageProcessingTransformRelativeOrientation;
441 imageprocess->SetRelativeOrientationOptionsL(orientationReference,
442 relativeRotation, relativeMirror, relativeFlipping);
444 CheckNotificationNeg(iInputEventUid, result);
446 CleanupStack::PopAndDestroy(imageprocess);
452 CleanupStack::PopAndDestroy(camera);
456 INFO_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
464 void RECamImageProcDefaultsTest::TestColorSwapL(CCamera::CCameraImageProcessing* aImageProcess, TVerdict& aResult)
466 CCamera::CCameraImageProcessing::TColorOperationCapabilities colorSwapCapabilities;
467 aImageProcess->GetColorSwapCapabilitiesL(0, colorSwapCapabilities);
469 if(!colorSwapCapabilities.iIsCapabilityUniform)
471 INFO_PRINTF1(_L("Non Uniform entries for color swap"));
474 //fill the parameters for color swap entry
475 CCamera::CCameraImageProcessing::TColorOperationEntry colorSwapParameters;
477 colorSwapParameters.iSourceColor.SetGreen(KValue);
478 colorSwapParameters.iTargetColor.SetBlue(KValue);
480 colorSwapParameters.iSourceColorRepresentation = CCamera::CCameraImageProcessing::ERepresentationSingle;
481 colorSwapParameters.iTargetColorRepresentation = CCamera::CCameraImageProcessing::ERepresentationSingle;
483 colorSwapParameters.iColorOperationSourceRgbGroupingMode = CCamera::CCameraImageProcessing::ERgbGroupingFixed;
484 colorSwapParameters.iColorOperationTargetRgbGroupingMode = CCamera::CCameraImageProcessing::ERgbGroupingFixed;
487 iInputEventUid = KUidECamEvent2CIPSetColorSwapEntry;
488 aImageProcess->SetColorSwapEntryL(0, colorSwapParameters);
490 CheckNotificationImgProc(iInputEventUid, 0, aResult);
492 //check the entry status
493 CCamera::CCameraImageProcessing::TColorOperationEntry getColorSwapParameters;
494 aImageProcess->GetColorSwapEntryL(0, getColorSwapParameters);
496 if(getColorSwapParameters.iEntryStatus != EDiscreteSteps)
498 INFO_PRINTF1(_L("Entry status set incorrectly"));
503 INFO_PRINTF1(_L("Entry status set correctly"));
506 //start the color swap process
507 iInputEventUid = KUidECamEventCIPStartColorSwap;
508 aImageProcess->StartColorSwappingL();
511 aImageProcess->CancelColorSwappingL();
513 CheckNotification(iInputEventUid, aResult);
516 iInputEventUid = KUidECamEventCIPRemoveColorSwapEntry;
517 aImageProcess->RemoveColorSwapEntryL(0);
518 CheckNotificationImgProc(iInputEventUid, 0, aResult);
520 //check the entry status
521 aImageProcess->GetColorSwapEntryL(0, getColorSwapParameters);
523 if(getColorSwapParameters.iEntryStatus != ENotActive)
525 INFO_PRINTF1(_L("Entry status set incorrectly"));
530 INFO_PRINTF1(_L("Entry status set correctly"));
534 void RECamImageProcDefaultsTest::TestColorAccentL(CCamera::CCameraImageProcessing* aImageProcess, TVerdict& aResult)
536 CCamera::CCameraImageProcessing::TColorOperationCapabilities colorAccentCapabilities;
537 aImageProcess->GetColorAccentCapabilitiesL(0, colorAccentCapabilities);
539 if(!colorAccentCapabilities.iIsCapabilityUniform)
541 INFO_PRINTF1(_L("Non Uniform entries for color accent"));
544 //fill the parameters for color swap entry
545 CCamera::CCameraImageProcessing::TColorOperationEntry colorAccentParameters;
547 colorAccentParameters.iSourceColor.SetGreen(KValue);
548 colorAccentParameters.iSourceColorRepresentation = CCamera::CCameraImageProcessing::ERepresentationSingle;
549 colorAccentParameters.iColorOperationSourceRgbGroupingMode = CCamera::CCameraImageProcessing::ERgbGroupingFixed;
552 iInputEventUid = KUidECamEventCIPSetColorAccentEntry;
553 aImageProcess->SetColorAccentEntryL(0, colorAccentParameters);
555 CheckNotificationImgProc(iInputEventUid, 0, aResult);
557 //check the entry status
558 CCamera::CCameraImageProcessing::TColorOperationEntry getColorAccentParameters;
559 aImageProcess->GetColorAccentEntryL(0, getColorAccentParameters);
561 if(getColorAccentParameters.iEntryStatus != EDiscreteSteps)
563 INFO_PRINTF1(_L("Entry status set incorrectly"));
568 INFO_PRINTF1(_L("Entry status set correctly"));
571 //start the color accent process
572 iInputEventUid = KUidECamEventCIPStartColorAccent;
573 aImageProcess->StartColorAccentL();
576 aImageProcess->CancelColorAccentL();
578 CheckNotification(iInputEventUid, aResult);
581 iInputEventUid = KUidECamEventCIPRemoveColorAccentEntry;
582 aImageProcess->RemoveColorAccentEntryL(0);
583 CheckNotificationImgProc(iInputEventUid, 0, aResult);
585 //check the entry status
586 aImageProcess->GetColorAccentEntryL(0, getColorAccentParameters);
588 if(getColorAccentParameters.iEntryStatus != ENotActive)
590 INFO_PRINTF1(_L("Entry status set incorrectly"));
595 INFO_PRINTF1(_L("Entry status set correctly"));
600 // RECamImageProcRangesTest //
603 RECamImageProcRangesTest* RECamImageProcRangesTest::NewL(TBool aAllocTest)
605 RECamImageProcRangesTest* self = new (ELeave) RECamImageProcRangesTest(aAllocTest);
609 RECamImageProcRangesTest::RECamImageProcRangesTest(TBool)
611 iTestStepName = _L("MM-ECM-ADV-U-013-HP");
614 TVerdict RECamImageProcRangesTest::DoTestStepL()
616 TVerdict result = EPass;
617 CCamera* camera = NULL;
619 TInt error = KErrNone;
620 CCamera::CCameraImageProcessing* imageprocess = NULL;
623 INFO_PRINTF1(_L("Create camera using Camera::New2L() and MCameraObserver2"));
625 TRAP(error, camera = CCamera::New2L(*this,0,0));
629 CleanupStack::PushL(camera);
630 INFO_PRINTF1(_L("KErrNone return from CCamera::New2L()"));
631 imageprocess = static_cast<CCamera::CCameraImageProcessing*> (camera->CustomInterface(KECamImageProcessingUid));
632 if (imageprocess!= NULL)
634 CleanupStack::PushL(imageprocess);
636 // Get Transformation Supported Values for brightness
637 iInputEventUid = KUidECamEventImageProcessingAdjustBrightness;
638 RArray<TInt> transfSuppValues;
639 CleanupClosePushL(transfSuppValues);
640 transfSuppValues.Reset();
641 TValueInfo valueInfo;
642 imageprocess->GetTransformationSupportedValuesL(iInputEventUid, transfSuppValues, valueInfo);
644 // Set a non supported Transformation value
646 imageprocess->SetTransformationValue(iInputEventUid, aSetValue);
648 CheckNotification(iInputEventUid, result);
650 TInt aGetValue =imageprocess->TransformationValue(iInputEventUid);
651 if (aSetValue != aGetValue)
653 INFO_PRINTF3(_L("Set unsupported TransformationValue set %d, get %d"), aSetValue, aGetValue);
656 CleanupStack::PopAndDestroy(&transfSuppValues);
658 CleanupStack::PopAndDestroy(imageprocess);
664 CleanupStack::PopAndDestroy(camera);
668 INFO_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
677 // RECamPresetsNegTest //
679 RECamImageProcNegTest* RECamImageProcNegTest::NewL(TBool aAllocTest)
681 RECamImageProcNegTest* self = new (ELeave) RECamImageProcNegTest(aAllocTest);
685 RECamImageProcNegTest::RECamImageProcNegTest(TBool /*aAllocTest*/)
687 iTestStepName = _L("MM-ECM-ADV-U-0103-HP");
690 TVerdict RECamImageProcNegTest::DoTestStepL()
692 TVerdict result = EPass;
693 CCamera* camera = NULL;
695 TInt error = KErrNone;
696 CCamera::CCameraImageProcessing* imageprocess = NULL;
700 INFO_PRINTF1(_L("Create camera using Camera::New2L() and MCameraObserver2"));
702 TRAP(error, camera = CCamera::New2L(*this,0,0));
706 CleanupStack::PushL(camera);
707 INFO_PRINTF1(_L("KErrNone return from CCamera::New2L()"));
708 imageprocess = static_cast<CCamera::CCameraImageProcessing*> (camera->CustomInterface(KECamImageProcessingUid));
709 if (imageprocess!= NULL)
711 CleanupStack::PushL(imageprocess);
713 // Supported Transformations
714 RArray<TUid> suppTransfUids;
715 CleanupClosePushL(suppTransfUids);
716 suppTransfUids.Reset();
717 imageprocess->GetSupportedTransformationsL(suppTransfUids);
718 // Get Supported Values for chosen transformation
719 iInputEventUid = KUidECamEventImageProcessingAdjustBrightness;
720 RArray<TInt> transfSuppValues;
721 CleanupClosePushL(transfSuppValues);
722 transfSuppValues.Reset();
723 TValueInfo valueInfo;
724 imageprocess->GetTransformationSupportedValuesL(iInputEventUid, transfSuppValues, valueInfo);
725 // Set a non supported Transformation value.
726 TInt aSetValue = KValue;
727 imageprocess->SetTransformationValue(iInputEventUid, aSetValue);
729 CheckNotificationNeg(iInputEventUid, result);
731 // Check that value has not changed.
732 TInt aGetValue =imageprocess->TransformationValue(iInputEventUid);
733 if (aSetValue == aGetValue)
735 INFO_PRINTF2(_L("Set unsupported TransformationValue set %d"), aSetValue);
739 CCamera::CCameraImageProcessing::TOrientationReference orientationReference =
740 CCamera::CCameraImageProcessing::EOrientationReferenceCameraSensorOrientation;
742 CCamera::CCameraImageProcessing::TRelativeRotation relativeRotation =
743 CCamera::CCameraImageProcessing::ERelativeRotation0Degrees;
745 CCamera::CCameraImageProcessing::TRelativeMirror relativeMirror =
746 CCamera::CCameraImageProcessing::ERelativeMirrorNone;
748 CCamera::CCameraImageProcessing::TRelativeFlipping relativeFlipping =
749 CCamera::CCameraImageProcessing::ERelativeFlippingNone;
751 INFO_PRINTF1(_L("SetRelativeOrientationOptionsL method invocation"));
752 iInputEventUid = KUidECamEventImageProcessingTransformRelativeOrientation;
753 imageprocess->SetRelativeOrientationOptionsL(orientationReference,
754 relativeRotation, relativeMirror, relativeFlipping);
756 CheckNotificationNeg(iInputEventUid, result);
758 CleanupStack::PopAndDestroy(2, &suppTransfUids); //transfSuppValues
760 CleanupStack::PopAndDestroy(imageprocess);
766 CleanupStack::PopAndDestroy(camera);
770 INFO_PRINTF2(_L("Unexpected %d return from CCamera::New2L(): observer 2"), error);
779 // RECamImageProcBaselineTest //
782 RECamImageProcBaselineTest* RECamImageProcBaselineTest::NewL(TBool aAllocTest)
784 RECamImageProcBaselineTest* self = new (ELeave) RECamImageProcBaselineTest(aAllocTest);
788 RECamImageProcBaselineTest::RECamImageProcBaselineTest(TBool)
790 iTestStepName = _L("MM-ECM-ADV-U-047-HP");
793 TBool RECamImageProcBaselineTest::CompareUidArrays(RArray<TUid>& firstArray, RArray<TUid>& secondArray)
795 TBool result = ETrue;
797 if (firstArray.Count() != secondArray.Count())
803 for (TInt expected = 0; expected < firstArray.Count(); expected++)
806 for (TInt actual = 0; actual < secondArray.Count(); actual++)
808 if (secondArray[actual] == firstArray[expected])
819 TVerdict RECamImageProcBaselineTest::DoTestStepL()
821 TVerdict result = EPass;
822 CCamera* camera = NULL;
824 TInt error = KErrNone;
825 CCamera::CCameraImageProcessing* imageprocess = NULL;
828 INFO_PRINTF1(_L("Create camera using Camera::NewL() and MCameraObserver2"));
830 TRAP(error, camera = CCamera::NewL(*this,0,0));
834 CleanupStack::PushL(camera);
835 INFO_PRINTF1(_L("KErrNone return from CCamera::NewL()"));
836 imageprocess = static_cast<CCamera::CCameraImageProcessing*> (camera->CustomInterface(KECamImageProcessingUid));
837 if (imageprocess!= NULL)
839 CleanupStack::PushL(imageprocess);
841 // Supported Transformations
842 RArray<TUid> expectedTransfUids;
843 CleanupClosePushL(expectedTransfUids);
844 expectedTransfUids.Reset();
845 // set the expected UIDS
846 expectedTransfUids.AppendL(KUidECamEventImageProcessingAdjustBrightness);
847 expectedTransfUids.AppendL(KUidECamEventImageProcessingAdjustContrast);
848 expectedTransfUids.AppendL(KUidECamEventImageProcessingEffect);
849 RArray<TUid> suppTransfUids;
850 CleanupClosePushL(suppTransfUids);
851 imageprocess->GetSupportedTransformationsL(suppTransfUids);
852 if (CompareUidArrays(expectedTransfUids, suppTransfUids) == EFalse)
854 INFO_PRINTF1(_L("GetSupportedTransformationsL failed"));
857 expectedTransfUids.Reset();
858 suppTransfUids.Reset();
859 CleanupStack::PopAndDestroy(2, &expectedTransfUids); //suppTransfUids
861 // Active Transformations
862 RArray<TUid> expectedActTransfUids;
863 CleanupClosePushL(expectedActTransfUids);
864 expectedActTransfUids.Reset();
865 // set the expected UIDS
866 expectedActTransfUids.AppendL(KUidECamEventImageProcessingAdjustBrightness);
867 expectedActTransfUids.AppendL(KUidECamEventImageProcessingAdjustContrast);
868 expectedActTransfUids.AppendL(KUidECamEventImageProcessingEffect);
869 RArray<TUid> actTransfUids;
870 CleanupClosePushL(actTransfUids);
871 actTransfUids.Reset();
872 imageprocess->GetActiveTransformationsL(actTransfUids);
873 if (CompareUidArrays(expectedActTransfUids, actTransfUids) == EFalse)
875 INFO_PRINTF1(_L("GetActiveTransformationsL failed"));
878 CleanupStack::PopAndDestroy(2, &expectedActTransfUids); //actTransfUids
881 RArray<TUid> expectedTransfSequence;
882 CleanupClosePushL(expectedTransfSequence);
883 expectedTransfSequence.Reset();
884 expectedTransfSequence.Append(KUidECamEventImageProcessingEffect);
886 imageprocess->SetActiveTransformSequenceL(expectedTransfSequence);
888 RArray<TUid> actTransfSequence;
889 CleanupClosePushL(actTransfSequence);
890 actTransfSequence.Reset();
891 imageprocess->GetActiveTransformSequenceL(actTransfSequence);
892 if (CompareUidArrays(expectedTransfSequence, actTransfSequence) == EFalse)
894 INFO_PRINTF1(_L("GetActiveTransformSequenceL failed"));
897 CleanupStack::PopAndDestroy(2, &expectedTransfSequence); //actTransfSequence
900 //Set Effect Transformation with color swap
901 iInputEventUid = KUidECamEventImageProcessingEffect;
902 RArray<TInt> supportedEffects;
904 TValueInfo info = ENotActive;
905 imageprocess->GetTransformationSupportedValuesL(iInputEventUid, supportedEffects, info);
907 TInt effects = supportedEffects[0];
908 supportedEffects.Close();
910 if(info != EBitField)
912 INFO_PRINTF1(_L("Incorrect TValueInfo provided"));
916 if(effects > KBaselinedEffects)
918 INFO_PRINTF1(_L("Unfamiliar enum value returned"));
922 imageprocess->SetTransformationValue(iInputEventUid, CCamera::CCameraImageProcessing::EEffectColorSwap);
923 CheckNotification(iInputEventUid, result);
925 // Check that value has actually changed to EEffectNone due to baselining.
926 TInt getValue = imageprocess->TransformationValue(iInputEventUid);
927 if (getValue != static_cast<TInt>(CCamera::CCameraImageProcessing::EEffectNone))
929 INFO_PRINTF1(_L("Got unfamiliar TransformationValue"));
934 INFO_PRINTF1(_L("Transformation value set to EEffectNone due to baselining"));
937 CleanupStack::PopAndDestroy(imageprocess);
943 CleanupStack::PopAndDestroy(camera);
947 INFO_PRINTF2(_L("Unexpected %d return from CCamera::NewL(): observer 2"), error);